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 "xfa/fxjse/runtime.h" | 7 #include "xfa/fxjse/runtime.h" |
8 | 8 |
9 #include "fpdfsdk/include/jsapi/fxjs_v8.h" | 9 #include "fpdfsdk/jsapi/include/fxjs_v8.h" |
10 #include "xfa/fxjse/scope_inline.h" | 10 #include "xfa/fxjse/scope_inline.h" |
11 | 11 |
12 // Duplicates fpdfsdk's cjs_runtime.h, but keeps XFA from depending on it. | 12 // Duplicates fpdfsdk's cjs_runtime.h, but keeps XFA from depending on it. |
13 // TODO(tsepez): make a single version of this. | 13 // TODO(tsepez): make a single version of this. |
14 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 14 class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
15 void* Allocate(size_t length) override { return calloc(1, length); } | 15 void* Allocate(size_t length) override { return calloc(1, length); } |
16 void* AllocateUninitialized(size_t length) override { return malloc(length); } | 16 void* AllocateUninitialized(size_t length) override { return malloc(length); } |
17 void Free(void* data, size_t length) override { free(data); } | 17 void Free(void* data, size_t length) override { free(data); } |
18 }; | 18 }; |
19 | 19 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void CFXJSE_RuntimeList::RemoveAllRuntimes( | 119 void CFXJSE_RuntimeList::RemoveAllRuntimes( |
120 CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { | 120 CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { |
121 int32_t iSize = m_RuntimeList.GetSize(); | 121 int32_t iSize = m_RuntimeList.GetSize(); |
122 if (lpfnDisposeCallback) { | 122 if (lpfnDisposeCallback) { |
123 for (int32_t iIdx = 0; iIdx < iSize; iIdx++) { | 123 for (int32_t iIdx = 0; iIdx < iSize; iIdx++) { |
124 lpfnDisposeCallback(m_RuntimeList[iIdx]); | 124 lpfnDisposeCallback(m_RuntimeList[iIdx]); |
125 } | 125 } |
126 } | 126 } |
127 m_RuntimeList.RemoveAll(); | 127 m_RuntimeList.RemoveAll(); |
128 } | 128 } |
OLD | NEW |