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

Side by Side Diff: fpdfsdk/javascript/JS_Object.cpp

Issue 2245863002: Push v8::Isolate into CFXJS_Engine class (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Null isolate before letting CFXJS_Engine dtor invoked Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/javascript/JS_Runtime_Stub.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/JS_Object.h" 7 #include "fpdfsdk/javascript/JS_Object.h"
8 8
9 #include "fpdfsdk/include/fsdk_mgr.h" 9 #include "fpdfsdk/include/fsdk_mgr.h"
10 #include "fpdfsdk/javascript/JS_Define.h" 10 #include "fpdfsdk/javascript/JS_Define.h"
11 #include "fpdfsdk/javascript/cjs_context.h" 11 #include "fpdfsdk/javascript/cjs_context.h"
12 12
13 CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {} 13 CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {}
14 14
15 CJS_EmbedObj::~CJS_EmbedObj() { 15 CJS_EmbedObj::~CJS_EmbedObj() {
16 } 16 }
17 17
18 void FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { 18 void FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data) {
19 CJS_Object* pJSObj = data.GetParameter(); 19 CJS_Object* pJSObj = data.GetParameter();
20 pJSObj->ExitInstance(); 20 pJSObj->ExitInstance();
21 delete pJSObj; 21 delete pJSObj;
22 FXJS_FreePrivate(data.GetInternalField(0)); 22 CFXJS_Engine::FreeObjectPrivate(data.GetInternalField(0));
23 } 23 }
24 24
25 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { 25 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) {
26 CJS_Object* pJSObj = data.GetParameter(); 26 CJS_Object* pJSObj = data.GetParameter();
27 pJSObj->Dispose(); 27 pJSObj->Dispose();
28 data.SetSecondPassCallback(FreeObject); 28 data.SetSecondPassCallback(FreeObject);
29 } 29 }
30 30
31 CJS_Object::CJS_Object(v8::Local<v8::Object> pObject) { 31 CJS_Object::CJS_Object(v8::Local<v8::Object> pObject) {
32 m_pIsolate = pObject->GetIsolate(); 32 m_pIsolate = pObject->GetIsolate();
33 m_pV8Object.Reset(m_pIsolate, pObject); 33 m_pV8Object.Reset(m_pIsolate, pObject);
34 } 34 }
35 35
36 CJS_Object::~CJS_Object() {} 36 CJS_Object::~CJS_Object() {}
37 37
38 void CJS_Object::MakeWeak() { 38 void CJS_Object::MakeWeak() {
39 m_pV8Object.SetWeak(this, DisposeObject, 39 m_pV8Object.SetWeak(this, DisposeObject,
40 v8::WeakCallbackType::kInternalFields); 40 v8::WeakCallbackType::kInternalFields);
41 } 41 }
42 42
43 void CJS_Object::Dispose() { 43 void CJS_Object::Dispose() {
44 m_pV8Object.Reset(); 44 m_pV8Object.Reset();
45 } 45 }
46 46
47 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {} 47 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {}
48 48
49 void CJS_Object::ExitInstance() {} 49 void CJS_Object::ExitInstance() {}
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/javascript/JS_Runtime_Stub.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698