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

Side by Side Diff: fxjs/fxjs_v8.cpp

Issue 2354353002: Set up isolate in CFXJS_Engine's constructor (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | fxjs/fxjs_v8_embeddertest.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 "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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | fxjs/fxjs_v8_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698