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 "fxjs/include/fxjs_v8.h" | 7 #include "fxjs/include/fxjs_v8.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // static | 212 // static |
213 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { | 213 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { |
214 return static_cast<FXJS_PerIsolateData*>( | 214 return static_cast<FXJS_PerIsolateData*>( |
215 pIsolate->GetData(g_embedderDataSlot)); | 215 pIsolate->GetData(g_embedderDataSlot)); |
216 } | 216 } |
217 | 217 |
218 FXJS_PerIsolateData::FXJS_PerIsolateData() : m_pDynamicObjsMap(nullptr) {} | 218 FXJS_PerIsolateData::FXJS_PerIsolateData() : m_pDynamicObjsMap(nullptr) {} |
219 | 219 |
220 CFXJS_Engine::CFXJS_Engine() : m_isolate(nullptr) {} | 220 CFXJS_Engine::CFXJS_Engine() : m_isolate(nullptr) {} |
221 | 221 |
| 222 CFXJS_Engine::CFXJS_Engine(v8::Isolate* pIsolate) : m_isolate(pIsolate) {} |
| 223 |
222 CFXJS_Engine::~CFXJS_Engine() { | 224 CFXJS_Engine::~CFXJS_Engine() { |
223 m_V8PersistentContext.Reset(); | 225 m_V8PersistentContext.Reset(); |
224 } | 226 } |
225 | 227 |
226 // static | 228 // static |
227 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) { | 229 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) { |
228 return static_cast<CFXJS_Engine*>( | 230 return static_cast<CFXJS_Engine*>( |
229 pIsolate->GetCurrentContext()->GetAlignedPointerFromEmbedderData( | 231 pIsolate->GetCurrentContext()->GetAlignedPointerFromEmbedderData( |
230 kPerContextDataIndex)); | 232 kPerContextDataIndex)); |
231 } | 233 } |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 797 } |
796 | 798 |
797 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, | 799 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, |
798 v8::Local<v8::Array> array) { | 800 v8::Local<v8::Array> array) { |
799 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); | 801 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); |
800 } | 802 } |
801 | 803 |
802 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { | 804 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { |
803 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); | 805 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); |
804 } | 806 } |
OLD | NEW |