diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-07 12:52:13 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-07 12:52:13 -0700 |
commit | 213a172779fddbd7e588ee2e2b3906ccc47d6896 (patch) | |
tree | 616a1277bf9f6cc007c2408a4cf0c0e7abfe67c3 /fpdfsdk/src/javascript/JS_Define.h | |
parent | 4401d4095d1306fa844170d70ae7647bc10f2d2d (diff) | |
download | pdfium-213a172779fddbd7e588ee2e2b3906ccc47d6896.tar.xz |
Rename IFXJS_Runtime and IFXJS_Context to IJS_.
Nothing but sed.
FXJS is a layer that makes it easier to define objects in V8, but has
no knowledge of PDF-specific native objects. It could in theory be used
to implement other sets of native objects.
JS is the layer that implements PDF-specific native objects on top of
FXJS.
Therefore, the classes used to interface to JS should be named using
IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1386173002 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Define.h')
-rw-r--r-- | fpdfsdk/src/javascript/JS_Define.h | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/fpdfsdk/src/javascript/JS_Define.h b/fpdfsdk/src/javascript/JS_Define.h index a3d98d5431..766bf4baba 100644 --- a/fpdfsdk/src/javascript/JS_Define.h +++ b/fpdfsdk/src/javascript/JS_Define.h @@ -71,19 +71,18 @@ struct JSMethodSpec { } \ ; -template <class C, - FX_BOOL (C::*M)(IFXJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError)> +template < + class C, + FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)> void JSPropGetter(const char* prop_name_string, const char* class_name_string, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* pContext = pRuntime->GetCurrentContext(); + IJS_Context* pContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); CFX_WideString sError; @@ -97,20 +96,19 @@ void JSPropGetter(const char* prop_name_string, info.GetReturnValue().Set((v8::Local<v8::Value>)value); } -template <class C, - FX_BOOL (C::*M)(IFXJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError)> +template < + class C, + FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)> void JSPropSetter(const char* prop_name_string, const char* class_name_string, v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* pContext = pRuntime->GetCurrentContext(); + IJS_Context* pContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); CFX_WideString sError; @@ -137,7 +135,7 @@ void JSPropSetter(const char* prop_name_string, } template <class C, - FX_BOOL (C::*M)(IFXJS_Context* cc, + FX_BOOL (C::*M)(IJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)> @@ -145,10 +143,10 @@ void JSMethod(const char* method_name_string, const char* class_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* cc = pRuntime->GetCurrentContext(); + IJS_Context* cc = pRuntime->GetCurrentContext(); CJS_Parameters parameters; for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { parameters.push_back(CJS_Value(isolate, info[i], CJS_Value::VT_unknown)); @@ -246,17 +244,17 @@ void JSMethod(const char* method_name_string, DefineMethods(pIsolate); \ } -#define DECLARE_JS_CLASS_RICH_PART() \ - static void JSConstructor(IFXJS_Context* cc, v8::Local<v8::Object> obj); \ - static void JSDestructor(v8::Local<v8::Object> obj); \ - static void DefineProps(v8::Isolate* pIsoalte); \ - static void DefineMethods(v8::Isolate* pIsoalte); \ - static JSPropertySpec JS_Class_Properties[]; \ +#define DECLARE_JS_CLASS_RICH_PART() \ + static void JSConstructor(IJS_Context* cc, v8::Local<v8::Object> obj); \ + static void JSDestructor(v8::Local<v8::Object> obj); \ + static void DefineProps(v8::Isolate* pIsoalte); \ + static void DefineMethods(v8::Isolate* pIsoalte); \ + static JSPropertySpec JS_Class_Properties[]; \ static JSMethodSpec JS_Class_Methods[]; #define IMPLEMENT_JS_CLASS_RICH_PART(js_class_name, class_alternate, \ class_name) \ - void js_class_name::JSConstructor(IFXJS_Context* cc, \ + void js_class_name::JSConstructor(IJS_Context* cc, \ v8::Local<v8::Object> obj) { \ CJS_Object* pObj = new js_class_name(obj); \ pObj->SetEmbedObject(new class_alternate(pObj)); \ @@ -367,10 +365,10 @@ void JSSpecialPropGet(const char* class_name, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); + IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); @@ -393,10 +391,10 @@ void JSSpecialPropPut(const char* class_name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); + IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); @@ -416,10 +414,10 @@ void JSSpecialPropDel(const char* class_name, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Boolean>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); + IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); @@ -434,17 +432,17 @@ void JSSpecialPropDel(const char* class_name, } } -template <FX_BOOL (*F)(IFXJS_Context* cc, +template <FX_BOOL (*F)(IJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)> void JSGlobalFunc(const char* func_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); if (!pRuntime) return; - IFXJS_Context* cc = pRuntime->GetCurrentContext(); + IJS_Context* cc = pRuntime->GetCurrentContext(); CJS_Parameters parameters; for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { parameters.push_back(CJS_Value(isolate, info[i], CJS_Value::VT_unknown)); |