| 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 "../../include/jsapi/fxjs_v8.h" | 7 #include "../../include/jsapi/fxjs_v8.h" |
| 8 | 8 |
| 9 #include "../../../core/include/fxcrt/fx_basic.h" | 9 #include "../../../core/include/fxcrt/fx_basic.h" |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 // Provide backwards compatibility when no external isolate. | 160 // Provide backwards compatibility when no external isolate. |
| 161 if (!g_arrayBufferAllocator) | 161 if (!g_arrayBufferAllocator) |
| 162 g_arrayBufferAllocator = new FXJS_ArrayBufferAllocator(); | 162 g_arrayBufferAllocator = new FXJS_ArrayBufferAllocator(); |
| 163 v8::Isolate::CreateParams params; | 163 v8::Isolate::CreateParams params; |
| 164 params.array_buffer_allocator = g_arrayBufferAllocator; | 164 params.array_buffer_allocator = g_arrayBufferAllocator; |
| 165 *pResultIsolate = v8::Isolate::New(params); | 165 *pResultIsolate = v8::Isolate::New(params); |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 size_t FXJS_GlobalIsolateRefCount() { |
| 170 return g_isolate_ref_count; |
| 171 } |
| 172 |
| 169 // static | 173 // static |
| 170 void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) { | 174 void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) { |
| 171 if (!pIsolate->GetData(g_embedderDataSlot)) | 175 if (!pIsolate->GetData(g_embedderDataSlot)) |
| 172 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData()); | 176 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData()); |
| 173 } | 177 } |
| 174 | 178 |
| 175 // static | 179 // static |
| 176 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { | 180 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { |
| 177 return static_cast<FXJS_PerIsolateData*>( | 181 return static_cast<FXJS_PerIsolateData*>( |
| 178 pIsolate->GetData(g_embedderDataSlot)); | 182 pIsolate->GetData(g_embedderDataSlot)); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 return v8::Local<v8::Array>(); | 781 return v8::Local<v8::Array>(); |
| 778 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 782 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 779 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 783 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
| 780 } | 784 } |
| 781 | 785 |
| 782 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | 786 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
| 783 pTo = pFrom; | 787 pTo = pFrom; |
| 784 } | 788 } |
| 785 | 789 |
| 786 | 790 |
| OLD | NEW |