diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-10-26 16:48:30 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-26 21:02:17 +0000 |
commit | ef299534cce8cc42f1bd13665a75947c88195ce0 (patch) | |
tree | 92e97b4f19dc7d8bdae7c0f43b549ad9d49bcdc4 /fpdfsdk/javascript/cjs_global.cpp | |
parent | 15776cf22182e74d8546849780ec0cf61b96ca95 (diff) | |
download | pdfium-ef299534cce8cc42f1bd13665a75947c88195ce0.tar.xz |
Cleanup statics in JS classes
This CL removes the static object IDs from each of the CJS_Object
subclasses and moves them to anonymous namespaces. The Spec arrays are
moved to private members of the object classes.
Change-Id: I5dcdb87ef57e4b374b5431580fb55cb75023f8fb
Reviewed-on: https://pdfium-review.googlesource.com/16950
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/cjs_global.cpp')
-rw-r--r-- | fpdfsdk/javascript/cjs_global.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fpdfsdk/javascript/cjs_global.cpp b/fpdfsdk/javascript/cjs_global.cpp index 95782acccf..826d26c638 100644 --- a/fpdfsdk/javascript/cjs_global.cpp +++ b/fpdfsdk/javascript/cjs_global.cpp @@ -174,15 +174,11 @@ class JSGlobalAlternate : public CJS_EmbedObj { } // namespace -JSConstSpec CJS_Global::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}}; - -JSPropertySpec CJS_Global::PropertySpecs[] = {{0, 0, 0}}; - JSMethodSpec CJS_Global::MethodSpecs[] = { {"setPersistent", setPersistent_static}, {0, 0}}; -int CJS_Global::g_nObjDefnID = -1; +int CJS_Global::ObjDefnID = -1; // static void CJS_Global::setPersistent_static( @@ -191,25 +187,21 @@ void CJS_Global::setPersistent_static( "setPersistent", "global", info); } -void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { - CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); - JSGlobalAlternate* pGlobal = - static_cast<JSGlobalAlternate*>(GetEmbedObject()); - pGlobal->Initial(pRuntime->GetFormFillEnv()); -} - +// static void CJS_Global::queryprop_static( v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { JSSpecialPropQuery<JSGlobalAlternate>("global", property, info); } +// static void CJS_Global::getprop_static( v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { JSSpecialPropGet<JSGlobalAlternate>("global", property, info); } +// static void CJS_Global::putprop_static( v8::Local<v8::String> property, v8::Local<v8::Value> value, @@ -217,28 +209,36 @@ void CJS_Global::putprop_static( JSSpecialPropPut<JSGlobalAlternate>("global", property, value, info); } +// static void CJS_Global::delprop_static( v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Boolean>& info) { JSSpecialPropDel<JSGlobalAlternate>("global", property, info); } +// static void CJS_Global::DefineAllProperties(CFXJS_Engine* pEngine) { pEngine->DefineObjAllProperties( - g_nObjDefnID, CJS_Global::queryprop_static, CJS_Global::getprop_static, + ObjDefnID, CJS_Global::queryprop_static, CJS_Global::getprop_static, CJS_Global::putprop_static, CJS_Global::delprop_static); } +// static void CJS_Global::DefineJSObjects(CFXJS_Engine* pEngine, FXJSOBJTYPE eObjType) { - g_nObjDefnID = pEngine->DefineObj( - "global", eObjType, JSConstructor<CJS_Global, JSGlobalAlternate>, - JSDestructor<CJS_Global>); - DefineConsts(pEngine, g_nObjDefnID, ConstSpecs); - DefineProps(pEngine, g_nObjDefnID, PropertySpecs); - DefineMethods(pEngine, g_nObjDefnID, MethodSpecs); + ObjDefnID = pEngine->DefineObj("global", eObjType, + JSConstructor<CJS_Global, JSGlobalAlternate>, + JSDestructor<CJS_Global>); + DefineMethods(pEngine, ObjDefnID, MethodSpecs); DefineAllProperties(pEngine); } +void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { + CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); + JSGlobalAlternate* pGlobal = + static_cast<JSGlobalAlternate*>(GetEmbedObject()); + pGlobal->Initial(pRuntime->GetFormFillEnv()); +} + JSGlobalData::JSGlobalData() : nType(JS_GlobalDataType::NUMBER), dData(0), |