OLD | NEW |
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 "JS_Object.h" | 7 #include "JS_Object.h" |
8 | 8 |
9 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 9 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
10 #include "../../include/javascript/IJavaScript.h" | 10 #include "../../include/javascript/IJavaScript.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 FXJS_FreePrivate(data.GetInternalField(0)); | 54 FXJS_FreePrivate(data.GetInternalField(0)); |
55 } | 55 } |
56 | 56 |
57 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { | 57 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { |
58 CJS_Object* pJSObj = data.GetParameter(); | 58 CJS_Object* pJSObj = data.GetParameter(); |
59 pJSObj->Dispose(); | 59 pJSObj->Dispose(); |
60 data.SetSecondPassCallback(FreeObject); | 60 data.SetSecondPassCallback(FreeObject); |
61 } | 61 } |
62 | 62 |
63 CJS_Object::CJS_Object(v8::Local<v8::Object> pObject) { | 63 CJS_Object::CJS_Object(v8::Local<v8::Object> pObject) { |
64 m_pIsolate = pObject->CreationContext()->GetIsolate(); | 64 m_pIsolate = pObject->GetIsolate(); |
65 m_pV8Object.Reset(m_pIsolate, pObject); | 65 m_pV8Object.Reset(m_pIsolate, pObject); |
66 } | 66 } |
67 | 67 |
68 CJS_Object::~CJS_Object() { | 68 CJS_Object::~CJS_Object() { |
69 } | 69 } |
70 | 70 |
71 void CJS_Object::MakeWeak() { | 71 void CJS_Object::MakeWeak() { |
72 m_pV8Object.SetWeak(this, DisposeObject, | 72 m_pV8Object.SetWeak(this, DisposeObject, |
73 v8::WeakCallbackType::kInternalFields); | 73 v8::WeakCallbackType::kInternalFields); |
74 } | 74 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // static | 152 // static |
153 CJS_Timer::TimerMap* CJS_Timer::GetGlobalTimerMap() { | 153 CJS_Timer::TimerMap* CJS_Timer::GetGlobalTimerMap() { |
154 // Leak the timer array at shutdown. | 154 // Leak the timer array at shutdown. |
155 static auto* s_TimerMap = new TimerMap; | 155 static auto* s_TimerMap = new TimerMap; |
156 return s_TimerMap; | 156 return s_TimerMap; |
157 } | 157 } |
158 | 158 |
159 void CJS_Timer::OnDestroyed() { | 159 void CJS_Timer::OnDestroyed() { |
160 m_bValid = false; | 160 m_bValid = false; |
161 } | 161 } |
OLD | NEW |