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/include/jsapi/fxjs_v8.h" // For per-isolate data. | 7 #include "fpdfsdk/include/jsapi/fxjs_v8.h" // For per-isolate data. |
8 #include "../../foxitlib.h" | 8 #include "xfa/src/foxitlib.h" |
9 #include "fxv8.h" | 9 #include "fxv8.h" |
10 #include "runtime.h" | 10 #include "runtime.h" |
11 #include "scope_inline.h" | 11 #include "scope_inline.h" |
12 | 12 |
13 // Duplicates fpdfsdk's JS_Runtime.h, but keeps XFA from depending on it. | 13 // Duplicates fpdfsdk's JS_Runtime.h, but keeps XFA from depending on it. |
14 // TODO(tsepez): make a single version of this. | 14 // TODO(tsepez): make a single version of this. |
15 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 15 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
16 void* Allocate(size_t length) override { return calloc(1, length); } | 16 void* Allocate(size_t length) override { return calloc(1, length); } |
17 void* AllocateUninitialized(size_t length) override { return malloc(length); } | 17 void* AllocateUninitialized(size_t length) override { return malloc(length); } |
18 void Free(void* data, size_t length) override { free(data); } | 18 void Free(void* data, size_t length) override { free(data); } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void CFXJSE_RuntimeList::RemoveAllRuntimes( | 103 void CFXJSE_RuntimeList::RemoveAllRuntimes( |
104 CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { | 104 CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { |
105 int32_t iSize = m_RuntimeList.GetSize(); | 105 int32_t iSize = m_RuntimeList.GetSize(); |
106 if (lpfnDisposeCallback) { | 106 if (lpfnDisposeCallback) { |
107 for (int32_t iIdx = 0; iIdx < iSize; iIdx++) { | 107 for (int32_t iIdx = 0; iIdx < iSize; iIdx++) { |
108 lpfnDisposeCallback(m_RuntimeList[iIdx]); | 108 lpfnDisposeCallback(m_RuntimeList[iIdx]); |
109 } | 109 } |
110 } | 110 } |
111 m_RuntimeList.RemoveAll(); | 111 m_RuntimeList.RemoveAll(); |
112 } | 112 } |
OLD | NEW |