OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "fpdfsdk/javascript/ijs_context.h" | 9 #include "fpdfsdk/javascript/ijs_context.h" |
10 #include "fpdfsdk/javascript/ijs_runtime.h" | 10 #include "fpdfsdk/javascript/ijs_runtime.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void OnExternal_Exec() override {} | 117 void OnExternal_Exec() override {} |
118 }; | 118 }; |
119 | 119 |
120 class CJS_RuntimeStub final : public IJS_Runtime { | 120 class CJS_RuntimeStub final : public IJS_Runtime { |
121 public: | 121 public: |
122 CJS_RuntimeStub() : m_pDoc(nullptr) {} | 122 CJS_RuntimeStub() : m_pDoc(nullptr) {} |
123 ~CJS_RuntimeStub() override {} | 123 ~CJS_RuntimeStub() override {} |
124 | 124 |
125 IJS_Context* NewContext() override { | 125 IJS_Context* NewContext() override { |
126 if (!m_pContext) | 126 if (!m_pContext) |
127 m_pContext.reset(new CJS_ContextStub()); | 127 m_pContext = WrapUnique(new CJS_ContextStub()); |
128 return GetCurrentContext(); | 128 return GetCurrentContext(); |
129 } | 129 } |
130 | 130 |
131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); } | 131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); } |
132 void ReleaseContext(IJS_Context* pContext) override {} | 132 void ReleaseContext(IJS_Context* pContext) override {} |
133 | 133 |
134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override { | 134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override { |
135 m_pDoc = pReaderDoc; | 135 m_pDoc = pReaderDoc; |
136 } | 136 } |
137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } | 137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } |
(...skipping 21 matching lines...) Expand all Loading... |
159 // static | 159 // static |
160 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} | 160 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} |
161 | 161 |
162 // static | 162 // static |
163 void IJS_Runtime::Destroy() {} | 163 void IJS_Runtime::Destroy() {} |
164 | 164 |
165 // static | 165 // static |
166 IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { | 166 IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { |
167 return new CJS_RuntimeStub; | 167 return new CJS_RuntimeStub; |
168 } | 168 } |
OLD | NEW |