Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: fpdfsdk/include/javascript/JS_Define.h

Issue 1370133007: Merge to XFA: Introduce kPerIsolateDataIndex and tidy JS_Define.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | fpdfsdk/include/jsapi/fxjs_v8.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/include/javascript/JS_Define.h
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index adf69ec0e9efd36c8475b7d91619e35fbd4d37fc..e91ce03d3054f3844fa7bacdeafbe985dcb4c3fa 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -79,12 +79,9 @@ void JSPropGetter(const char* prop_name_string,
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
@@ -107,12 +104,9 @@ void JSPropSetter(const char* prop_name_string,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
@@ -151,12 +145,9 @@ void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
@@ -282,12 +273,9 @@ void JSSpecialPropGet(const char* class_name,
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
@@ -311,12 +299,9 @@ void JSSpecialPropPut(const char* class_name,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
@@ -337,12 +322,9 @@ void JSSpecialPropDel(const char* class_name,
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Boolean>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
@@ -448,12 +430,9 @@ template <FX_BOOL (
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Value> v = context->GetEmbedderData(1);
- if (v.IsEmpty())
+ IFXJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate);
+ if (!pRuntime)
return;
- v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
« no previous file with comments | « DEPS ('k') | fpdfsdk/include/jsapi/fxjs_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698