| 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 "fxjse/runtime.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "fpdfsdk/jsapi/include/fxjs_v8.h" | 11 #include "fpdfsdk/jsapi/include/fxjs_v8.h" |
| 12 #include "xfa/fxjse/scope_inline.h" | 12 #include "fxjse/scope_inline.h" |
| 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 }; |
| 21 | 21 |
| 22 static void FXJSE_KillV8() { | 22 static void FXJSE_KillV8() { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 lpfnDisposeCallback(pIsolate, bFound); | 106 lpfnDisposeCallback(pIsolate, bFound); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void CFXJSE_IsolateTracker::RemoveAll( | 109 void CFXJSE_IsolateTracker::RemoveAll( |
| 110 CFXJSE_IsolateTracker::DisposeCallback lpfnDisposeCallback) { | 110 CFXJSE_IsolateTracker::DisposeCallback lpfnDisposeCallback) { |
| 111 for (v8::Isolate* pIsolate : m_OwnedIsolates) | 111 for (v8::Isolate* pIsolate : m_OwnedIsolates) |
| 112 lpfnDisposeCallback(pIsolate, true); | 112 lpfnDisposeCallback(pIsolate, true); |
| 113 | 113 |
| 114 m_OwnedIsolates.clear(); | 114 m_OwnedIsolates.clear(); |
| 115 } | 115 } |
| OLD | NEW |