| 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/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  Loading... | 
| 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 |  | 
| 244 // static | 236 // static | 
| 245 int CFXJS_Engine::GetObjDefnID(v8::Local<v8::Object> pObj) { | 237 int CFXJS_Engine::GetObjDefnID(v8::Local<v8::Object> pObj) { | 
| 246   if (pObj.IsEmpty() || !pObj->InternalFieldCount()) | 238   if (pObj.IsEmpty() || !pObj->InternalFieldCount()) | 
| 247     return -1; | 239     return -1; | 
| 248   CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>( | 240   CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>( | 
| 249       pObj->GetAlignedPointerFromInternalField(0)); | 241       pObj->GetAlignedPointerFromInternalField(0)); | 
| 250   if (!pPerObjectData) | 242   if (!pPerObjectData) | 
| 251     return -1; | 243     return -1; | 
| 252   return pPerObjectData->m_ObjDefID; | 244   return pPerObjectData->m_ObjDefID; | 
| 253 } | 245 } | 
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 790 } | 782 } | 
| 791 | 783 | 
| 792 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, | 784 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, | 
| 793                                  v8::Local<v8::Array> array) { | 785                                  v8::Local<v8::Array> array) { | 
| 794   m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); | 786   m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); | 
| 795 } | 787 } | 
| 796 | 788 | 
| 797 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { | 789 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { | 
| 798   return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); | 790   return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); | 
| 799 } | 791 } | 
| OLD | NEW | 
|---|