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

Side by Side Diff: fxjs/fxjs_v8.cpp

Issue 2414883006: Revert of Reland: Make the CPDFXFA_App non-global (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 | « fxjs/fxjs_v8.h ('k') | no next file » | 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/fxjs_v8.h" 7 #include "fxjs/fxjs_v8.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 m_V8PersistentContext.Reset(); 226 m_V8PersistentContext.Reset();
227 } 227 }
228 228
229 // static 229 // static
230 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) { 230 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) {
231 return static_cast<CFXJS_Engine*>( 231 return static_cast<CFXJS_Engine*>(
232 pIsolate->GetCurrentContext()->GetAlignedPointerFromEmbedderData( 232 pIsolate->GetCurrentContext()->GetAlignedPointerFromEmbedderData(
233 kPerContextDataIndex)); 233 kPerContextDataIndex));
234 } 234 }
235 235
236 #ifdef PDF_ENABLE_XFA
237 // static
238 void CFXJS_Engine::SetForV8Context(v8::Local<v8::Context> v8Context,
239 CFXJS_Engine* pEngine) {
240 v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pEngine);
241 }
242 #endif // PDF_ENABLE_XFA
243
236 // static 244 // static
237 int CFXJS_Engine::GetObjDefnID(v8::Local<v8::Object> pObj) { 245 int CFXJS_Engine::GetObjDefnID(v8::Local<v8::Object> pObj) {
238 if (pObj.IsEmpty() || !pObj->InternalFieldCount()) 246 if (pObj.IsEmpty() || !pObj->InternalFieldCount())
239 return -1; 247 return -1;
240 CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>( 248 CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>(
241 pObj->GetAlignedPointerFromInternalField(0)); 249 pObj->GetAlignedPointerFromInternalField(0));
242 if (!pPerObjectData) 250 if (!pPerObjectData)
243 return -1; 251 return -1;
244 return pPerObjectData->m_ObjDefID; 252 return pPerObjectData->m_ObjDefID;
245 } 253 }
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 790 }
783 791
784 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, 792 void CFXJS_Engine::SetConstArray(const CFX_WideString& name,
785 v8::Local<v8::Array> array) { 793 v8::Local<v8::Array> array) {
786 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); 794 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array);
787 } 795 }
788 796
789 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { 797 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) {
790 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); 798 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]);
791 } 799 }
OLDNEW
« no previous file with comments | « fxjs/fxjs_v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698