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 "fpdfsdk/javascript/cjs_runtime.h" | 7 #include "fpdfsdk/javascript/cjs_runtime.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) { | 48 CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) { |
49 const CJS_Context* pContext = static_cast<const CJS_Context*>(cc); | 49 const CJS_Context* pContext = static_cast<const CJS_Context*>(cc); |
50 return pContext->GetJSRuntime(); | 50 return pContext->GetJSRuntime(); |
51 } | 51 } |
52 | 52 |
53 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) | 53 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) |
54 : m_pApp(pApp), | 54 : m_pApp(pApp), |
55 m_pDocument(NULL), | 55 m_pDocument(nullptr), |
56 m_bBlocking(FALSE), | 56 m_bBlocking(FALSE), |
57 m_isolate(NULL), | 57 m_isolate(nullptr), |
58 m_isolateManaged(false) { | 58 m_isolateManaged(false) { |
59 #ifndef PDF_ENABLE_XFA | 59 #ifndef PDF_ENABLE_XFA |
60 IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform; | 60 IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform; |
61 if (pPlatform->version <= 2) { | 61 if (pPlatform->version <= 2) { |
62 unsigned int embedderDataSlot = 0; | 62 unsigned int embedderDataSlot = 0; |
63 v8::Isolate* pExternalIsolate = nullptr; | 63 v8::Isolate* pExternalIsolate = nullptr; |
64 if (pPlatform->version == 2) { | 64 if (pPlatform->version == 2) { |
65 pExternalIsolate = reinterpret_cast<v8::Isolate*>(pPlatform->m_isolate); | 65 pExternalIsolate = reinterpret_cast<v8::Isolate*>(pPlatform->m_isolate); |
66 embedderDataSlot = pPlatform->m_v8EmbedderSlot; | 66 embedderDataSlot = pPlatform->m_v8EmbedderSlot; |
67 #else | 67 #else |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 #endif | 313 #endif |
314 void CJS_Runtime::AddObserver(Observer* observer) { | 314 void CJS_Runtime::AddObserver(Observer* observer) { |
315 ASSERT(!pdfium::ContainsKey(m_observers, observer)); | 315 ASSERT(!pdfium::ContainsKey(m_observers, observer)); |
316 m_observers.insert(observer); | 316 m_observers.insert(observer); |
317 } | 317 } |
318 | 318 |
319 void CJS_Runtime::RemoveObserver(Observer* observer) { | 319 void CJS_Runtime::RemoveObserver(Observer* observer) { |
320 ASSERT(pdfium::ContainsKey(m_observers, observer)); | 320 ASSERT(pdfium::ContainsKey(m_observers, observer)); |
321 m_observers.erase(observer); | 321 m_observers.erase(observer); |
322 } | 322 } |
OLD | NEW |