diff options
author | Jochen Eisinger <jochen@chromium.org> | 2015-05-19 00:38:00 +0200 |
---|---|---|
committer | Jochen Eisinger <jochen@chromium.org> | 2015-05-19 00:38:00 +0200 |
commit | dfa2c9939a85ad1c01ef858b21942ab3773dcf27 (patch) | |
tree | 064ae26fd633fe7ffcc6c72ce59bd2cfdd429246 /fpdfsdk/src/javascript/JS_Object.cpp | |
parent | 34d839653f3c7a821dadb8e3219f9a8da83d83e6 (diff) | |
download | pdfium-dfa2c9939a85ad1c01ef858b21942ab3773dcf27.tar.xz |
Merge V8 API updates to xfa branch
Set pointers in internal fields directly instead of wrapping them
Review URL: https://codereview.chromium.org/1139853003
Use phantom handles instead of weak handles
Review URL: https://codereview.chromium.org/1129253004
Replace deprecated with non-deprecated V8 APIs
Review URL: https://codereview.chromium.org/1126203010
Add myself to OWNERS file
Review URL: https://codereview.chromium.org/1133333005
Replace v8::Handle with v8::Local and v8::Persistent with v8::Global
Review URL: https://codereview.chromium.org/1138823004
TBR=tsepez@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1140033004
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Object.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/JS_Object.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index 44978fa421..96c5307e63 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -88,16 +88,19 @@ void CJS_EmbedObj::EndTimer(CJS_Timer* pTimer) } /* --------------------------------- CJS_Object --------------------------------- */ -void FreeObject(const v8::WeakCallbackData<v8::Object, CJS_Object>& data) +void FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { CJS_Object* pJSObj = data.GetParameter(); - if(pJSObj) - { - pJSObj->ExitInstance(); - delete pJSObj; - } - v8::Local<v8::Object> obj = data.GetValue(); - JS_FreePrivate(obj); + pJSObj->ExitInstance(); + delete pJSObj; + JS_FreePrivate(data.GetInternalField(0)); +} + +void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) +{ + CJS_Object* pJSObj = data.GetParameter(); + pJSObj->Dispose(); + data.SetSecondPassCallback(FreeObject); } CJS_Object::CJS_Object(JSFXObject pObject) :m_pEmbedObj(NULL) @@ -117,7 +120,13 @@ CJS_Object::~CJS_Object(void) void CJS_Object::MakeWeak() { - m_pObject.SetWeak(this, FreeObject); + m_pObject.SetWeak( + this, DisposeObject, v8::WeakCallbackType::kInternalFields); +} + +void CJS_Object::Dispose() +{ + m_pObject.Reset(); } CPDFSDK_PageView* CJS_Object::JSGetPageView(IFXJS_Context* cc) |