Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1400503003: Merge to XFA: Only call DefineJSObjects() once for the global V8 isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 // Provide backwards compatibility when no external isolate. 152 // Provide backwards compatibility when no external isolate.
153 if (!g_arrayBufferAllocator) 153 if (!g_arrayBufferAllocator)
154 g_arrayBufferAllocator = new FXJS_ArrayBufferAllocator(); 154 g_arrayBufferAllocator = new FXJS_ArrayBufferAllocator();
155 v8::Isolate::CreateParams params; 155 v8::Isolate::CreateParams params;
156 params.array_buffer_allocator = g_arrayBufferAllocator; 156 params.array_buffer_allocator = g_arrayBufferAllocator;
157 *pResultIsolate = v8::Isolate::New(params); 157 *pResultIsolate = v8::Isolate::New(params);
158 return true; 158 return true;
159 } 159 }
160 160
161 size_t FXJS_GlobalIsolateRefCount() {
162 return g_isolate_ref_count;
163 }
164
161 // static 165 // static
162 void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) { 166 void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) {
163 if (!pIsolate->GetData(g_embedderDataSlot)) 167 if (!pIsolate->GetData(g_embedderDataSlot))
164 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData()); 168 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData());
165 } 169 }
166 170
167 // static 171 // static
168 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { 172 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) {
169 return static_cast<FXJS_PerIsolateData*>( 173 return static_cast<FXJS_PerIsolateData*>(
170 pIsolate->GetData(g_embedderDataSlot)); 174 pIsolate->GetData(g_embedderDataSlot));
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 return v8::Local<v8::Array>(); 753 return v8::Local<v8::Array>();
750 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 754 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
751 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); 755 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
752 } 756 }
753 757
754 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { 758 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) {
755 pTo = pFrom; 759 pTo = pFrom;
756 } 760 }
757 761
758 762
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698