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

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

Issue 1394023002: Merge to XFA: Remove unused global argument from FXJS_CONSTRUCTOR. (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
« no previous file with comments | « fpdfsdk/src/javascript/JS_Define.h ('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 "../../../core/include/fxcrt/fx_basic.h" 7 #include "../../../core/include/fxcrt/fx_basic.h"
8 #include "../../include/jsapi/fxjs_v8.h" 8 #include "../../include/jsapi/fxjs_v8.h"
9 9
10 const wchar_t kFXJSValueNameString[] = L"string"; 10 const wchar_t kFXJSValueNameString[] = L"string";
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 v8Context->Global() 286 v8Context->Global()
287 ->GetPrototype() 287 ->GetPrototype()
288 ->ToObject(v8Context) 288 ->ToObject(v8Context)
289 .ToLocalChecked() 289 .ToLocalChecked()
290 ->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(i)); 290 ->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(i));
291 291
292 if (pObjDef->m_pConstructor) 292 if (pObjDef->m_pConstructor)
293 pObjDef->m_pConstructor(context, v8Context->Global() 293 pObjDef->m_pConstructor(context, v8Context->Global()
294 ->GetPrototype() 294 ->GetPrototype()
295 ->ToObject(v8Context) 295 ->ToObject(v8Context)
296 .ToLocalChecked(), 296 .ToLocalChecked());
297 v8Context->Global()
298 ->GetPrototype()
299 ->ToObject(v8Context)
300 .ToLocalChecked());
301 } else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) { 297 } else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) {
302 v8::Local<v8::Object> obj = FXJS_NewFxDynamicObj(pIsolate, context, i); 298 v8::Local<v8::Object> obj = FXJS_NewFxDynamicObj(pIsolate, context, i);
303 v8Context->Global()->Set(v8Context, m_ObjName, obj).FromJust(); 299 v8Context->Global()->Set(v8Context, m_ObjName, obj).FromJust();
304 pObjDef->m_StaticObj.Reset(pIsolate, obj); 300 pObjDef->m_StaticObj.Reset(pIsolate, obj);
305 } 301 }
306 } 302 }
307 v8PersistentContext.Reset(pIsolate, v8Context); 303 v8PersistentContext.Reset(pIsolate, v8Context);
308 } 304 }
309 305
310 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, 306 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return v8::Local<v8::Object>(); 392 return v8::Local<v8::Object>();
397 393
398 CFXJS_ObjDefinition* pObjDef = 394 CFXJS_ObjDefinition* pObjDef =
399 CFXJS_ObjDefinition::ForID(pIsolate, nObjDefnID); 395 CFXJS_ObjDefinition::ForID(pIsolate, nObjDefnID);
400 v8::Local<v8::Object> obj; 396 v8::Local<v8::Object> obj;
401 if (!pObjDef->GetInstanceTemplate()->NewInstance(context).ToLocal(&obj)) 397 if (!pObjDef->GetInstanceTemplate()->NewInstance(context).ToLocal(&obj))
402 return v8::Local<v8::Object>(); 398 return v8::Local<v8::Object>();
403 399
404 obj->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(nObjDefnID)); 400 obj->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(nObjDefnID));
405 if (pObjDef->m_pConstructor) 401 if (pObjDef->m_pConstructor)
406 pObjDef->m_pConstructor( 402 pObjDef->m_pConstructor(pJSContext, obj);
407 pJSContext, obj,
408 context->Global()->GetPrototype()->ToObject(context).ToLocalChecked());
409 403
410 return obj; 404 return obj;
411 } 405 }
412 406
413 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate) { 407 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate) {
414 v8::Isolate::Scope isolate_scope(pIsolate); 408 v8::Isolate::Scope isolate_scope(pIsolate);
415 if (!FXJS_PerIsolateData::Get(pIsolate)) 409 if (!FXJS_PerIsolateData::Get(pIsolate))
416 return v8::Local<v8::Object>(); 410 return v8::Local<v8::Object>();
417 411
418 // Return the global object. 412 // Return the global object.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 return v8::Local<v8::Array>(); 733 return v8::Local<v8::Array>();
740 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 734 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
741 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); 735 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
742 } 736 }
743 737
744 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { 738 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) {
745 pTo = pFrom; 739 pTo = pFrom;
746 } 740 }
747 741
748 742
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Define.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698