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

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

Issue 1366053003: XFA: Pass IFXJS_Runtime via V8 contexts, not V8 isolates (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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
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 "../../../core/include/fxcrt/fx_basic.h" 7 #include "../../../core/include/fxcrt/fx_basic.h"
8 #include "../../include/fsdk_define.h" 8 #include "../../include/fsdk_define.h"
9 #include "../../include/jsapi/fxjs_v8.h" 9 #include "../../include/jsapi/fxjs_v8.h"
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 v8::HandleScope handle_scope(pIsolate); 262 v8::HandleScope handle_scope(pIsolate);
263 263
264 v8::Global<v8::ObjectTemplate>& globalObjTemp = 264 v8::Global<v8::ObjectTemplate>& globalObjTemp =
265 _getGlobalObjectTemplate(pIsolate); 265 _getGlobalObjectTemplate(pIsolate);
266 v8::Local<v8::Context> v8Context = v8::Context::New( 266 v8::Local<v8::Context> v8Context = v8::Context::New(
267 pIsolate, NULL, 267 pIsolate, NULL,
268 v8::Local<v8::ObjectTemplate>::New(pIsolate, globalObjTemp)); 268 v8::Local<v8::ObjectTemplate>::New(pIsolate, globalObjTemp));
269 v8::Context::Scope context_scope(v8Context); 269 v8::Context::Scope context_scope(v8Context);
270 270
271 FXJS_PerIsolateData::SetUp(pIsolate); 271 FXJS_PerIsolateData::SetUp(pIsolate);
272 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); 272 v8::Local<v8::External> ptr = v8::External::New(pIsolate, pFXRuntime);
273 pData->m_pFXJSRuntime = pFXRuntime; 273 v8Context->SetEmbedderData(1, ptr);
jochen (gone - plz use gerrit) 2015/09/25 11:17:10 we should use kPerContextDataStartIndex + kEmbedde
Tom Sepez 2015/09/25 16:40:11 Ok, I'll make a new constant, but I don't want to
274 274
275 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); 275 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate);
276 for (int i = 0; i < maxID; ++i) { 276 for (int i = 0; i < maxID; ++i) {
277 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); 277 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i);
278 CFX_WideString ws = CFX_WideString(pObjDef->objName); 278 CFX_WideString ws = CFX_WideString(pObjDef->objName);
279 CFX_ByteString bs = ws.UTF8Encode(); 279 CFX_ByteString bs = ws.UTF8Encode();
280 v8::Local<v8::String> objName = 280 v8::Local<v8::String> objName =
281 v8::String::NewFromUtf8(pIsolate, bs.c_str(), 281 v8::String::NewFromUtf8(pIsolate, bs.c_str(),
282 v8::NewStringType::kNormal, 282 v8::NewStringType::kNormal,
283 bs.GetLength()).ToLocalChecked(); 283 bs.GetLength()).ToLocalChecked();
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 return v8::Local<v8::Array>(); 763 return v8::Local<v8::Array>();
764 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 764 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
765 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); 765 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
766 } 766 }
767 767
768 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { 768 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) {
769 pTo = pFrom; 769 pTo = pFrom;
770 } 770 }
771 771
772 772
OLDNEW
« fpdfsdk/include/javascript/JS_Define.h ('K') | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698