diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-08 12:24:19 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-08 12:24:19 -0700 |
commit | 67fd5df1a378195ae3fb40c862a4e6e58731020a (patch) | |
tree | 498a4803209d78747f97ed514c45981df47de3e5 /fpdfsdk/src/javascript/JS_Define.h | |
parent | 6d5649b46c73bde7de2488b5631ecbf0d4a3bb05 (diff) | |
download | pdfium-67fd5df1a378195ae3fb40c862a4e6e58731020a.tar.xz |
Merge to XFA: Wean CJS_Value off of v8::Isolate.
(cherry picked from commit 287b63d9ab410783d71cf37291f09fd57d3059b4)
Original Review URL: https://codereview.chromium.org/1394103002 .
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1394053003 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Define.h')
-rw-r--r-- | fpdfsdk/src/javascript/JS_Define.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/fpdfsdk/src/javascript/JS_Define.h b/fpdfsdk/src/javascript/JS_Define.h index 2ea278d802..178e28f3da 100644 --- a/fpdfsdk/src/javascript/JS_Define.h +++ b/fpdfsdk/src/javascript/JS_Define.h @@ -78,14 +78,15 @@ void JSPropGetter(const char* prop_name_string, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); if (!pRuntime) return; IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); CFX_WideString sError; - CJS_PropValue value(isolate); + CJS_PropValue value(pRuntime); value.StartGetting(); if (!(pObj->*M)(pRuntimeContext, value, sError)) { FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, @@ -103,14 +104,15 @@ void JSPropSetter(const char* prop_name_string, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) { v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); if (!pRuntime) return; IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); CFX_WideString sError; - CJS_PropValue propValue(CJS_Value(isolate, value, CJS_Value::VT_unknown)); + CJS_PropValue propValue(CJS_Value(pRuntime, value, CJS_Value::VT_unknown)); propValue.StartSetting(); if (!(pObj->*M)(pRuntimeContext, propValue, sError)) { FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, @@ -141,15 +143,16 @@ void JSMethod(const char* method_name_string, const char* class_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); if (!pRuntime) return; IJS_Context* pRuntimeContext = 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)); + parameters.push_back(CJS_Value(pRuntime, info[i], CJS_Value::VT_unknown)); } - CJS_Value valueRes(isolate); + CJS_Value valueRes(pRuntime); CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); CFX_WideString sError; @@ -363,7 +366,8 @@ void JSSpecialPropGet(const char* class_name, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); if (!pRuntime) return; IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); @@ -374,7 +378,7 @@ void JSSpecialPropGet(const char* class_name, CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); CFX_WideString sError; - CJS_PropValue value(isolate); + CJS_PropValue value(pRuntime); value.StartGetting(); if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) { FXJS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError)); @@ -389,7 +393,8 @@ void JSSpecialPropPut(const char* class_name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); if (!pRuntime) return; IJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); @@ -400,7 +405,7 @@ void JSSpecialPropPut(const char* class_name, CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); CFX_WideString sError; - CJS_PropValue PropValue(CJS_Value(isolate, value, CJS_Value::VT_unknown)); + CJS_PropValue PropValue(CJS_Value(pRuntime, value, CJS_Value::VT_unknown)); PropValue.StartSetting(); if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), PropValue, sError)) { FXJS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError)); @@ -436,19 +441,20 @@ template <FX_BOOL (*F)(IJS_Context* cc, CFX_WideString& sError)> void JSGlobalFunc(const char* func_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { - v8::Isolate* isolate = info.GetIsolate(); - IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); + CJS_Runtime* pRuntime = + static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(info.GetIsolate())); if (!pRuntime) return; IJS_Context* pRuntimeContext = 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)); + parameters.push_back(CJS_Value(pRuntime, info[i], CJS_Value::VT_unknown)); } - CJS_Value valueRes(isolate); + CJS_Value valueRes(pRuntime); CFX_WideString sError; if (!(*F)(pRuntimeContext, parameters, valueRes, sError)) { - FXJS_Error(isolate, JSFormatErrorString(func_name_string, nullptr, sError)); + FXJS_Error(pRuntime->GetIsolate(), + JSFormatErrorString(func_name_string, nullptr, sError)); return; } info.GetReturnValue().Set(valueRes.ToV8Value()); |