OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cfxjse_runtimedata.h" | 7 #include "fxjs/cfxjse_runtimedata.h" |
8 | 8 |
9 #include "fpdfsdk/jsapi/include/fxjs_v8.h" | |
10 #include "fxjs/cfxjse_isolatetracker.h" | 9 #include "fxjs/cfxjse_isolatetracker.h" |
| 10 #include "fxjs/include/fxjs_v8.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // Duplicates fpdfsdk's cjs_runtime.h, but keeps XFA from depending on it. | 14 // Duplicates fpdfsdk's cjs_runtime.h, but keeps XFA from depending on it. |
15 // TODO(tsepez): make a single version of this. | 15 // TODO(tsepez): make a single version of this. |
16 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 16 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
17 void* Allocate(size_t length) override { return calloc(1, length); } | 17 void* Allocate(size_t length) override { return calloc(1, length); } |
18 void* AllocateUninitialized(size_t length) override { return malloc(length); } | 18 void* AllocateUninitialized(size_t length) override { return malloc(length); } |
19 void Free(void* data, size_t length) override { free(data); } | 19 void Free(void* data, size_t length) override { free(data); } |
20 }; | 20 }; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) { | 97 CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) { |
98 FXJS_PerIsolateData::SetUp(pIsolate); | 98 FXJS_PerIsolateData::SetUp(pIsolate); |
99 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); | 99 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); |
100 if (!pData->m_pFXJSERuntimeData) | 100 if (!pData->m_pFXJSERuntimeData) |
101 pData->m_pFXJSERuntimeData = CFXJSE_RuntimeData::Create(pIsolate); | 101 pData->m_pFXJSERuntimeData = CFXJSE_RuntimeData::Create(pIsolate); |
102 return pData->m_pFXJSERuntimeData; | 102 return pData->m_pFXJSERuntimeData; |
103 } | 103 } |
104 | 104 |
105 CFXJSE_IsolateTracker* CFXJSE_IsolateTracker::g_pInstance = nullptr; | 105 CFXJSE_IsolateTracker* CFXJSE_IsolateTracker::g_pInstance = nullptr; |
OLD | NEW |