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

Side by Side Diff: fpdfsdk/src/javascript/global.cpp

Issue 1394993006: Merge to XFA: Pass IJS_Runtime, not IJS_Context, to native object constructors. (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/global.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | 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 "global.h" 7 #include "global.h"
8 8
9 #include "../../../core/include/fxcrt/fx_ext.h" 9 #include "../../../core/include/fxcrt/fx_ext.h"
10 #include "../../include/fpdfxfa/fpdfxfa_app.h" 10 #include "../../include/fpdfxfa/fpdfxfa_app.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 BEGIN_JS_STATIC_PROP(CJS_Global) 82 BEGIN_JS_STATIC_PROP(CJS_Global)
83 END_JS_STATIC_PROP() 83 END_JS_STATIC_PROP()
84 84
85 BEGIN_JS_STATIC_METHOD(CJS_Global) 85 BEGIN_JS_STATIC_METHOD(CJS_Global)
86 JS_STATIC_METHOD_ENTRY(setPersistent) 86 JS_STATIC_METHOD_ENTRY(setPersistent)
87 END_JS_STATIC_METHOD() 87 END_JS_STATIC_METHOD()
88 88
89 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); 89 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global);
90 90
91 FX_BOOL CJS_Global::InitInstance(IJS_Context* cc) { 91 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) {
92 CJS_Context* pContext = (CJS_Context*)cc; 92 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime);
93 ASSERT(pContext != NULL); 93 JSGlobalAlternate* pGlobal =
94 94 static_cast<JSGlobalAlternate*>(GetEmbedObject());
95 JSGlobalAlternate* pGlobal = (JSGlobalAlternate*)GetEmbedObject(); 95 pGlobal->Initial(pRuntime->GetReaderApp());
96 ASSERT(pGlobal != NULL); 96 }
97
98 pGlobal->Initial(pContext->GetReaderApp());
99
100 return TRUE;
101 };
102 97
103 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) 98 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject)
104 : CJS_EmbedObj(pJSObject), m_pApp(NULL) { 99 : CJS_EmbedObj(pJSObject), m_pApp(NULL) {
105 } 100 }
106 101
107 JSGlobalAlternate::~JSGlobalAlternate() { 102 JSGlobalAlternate::~JSGlobalAlternate() {
108 DestroyGlobalPersisitentVariables(); 103 DestroyGlobalPersisitentVariables();
109 m_pGlobalData->Release(); 104 m_pGlobalData->Release();
110 } 105 }
111 106
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 return CJS_Value::VT_boolean; 520 return CJS_Value::VT_boolean;
526 if (nHash == JSCONST_nDateHash) 521 if (nHash == JSCONST_nDateHash)
527 return CJS_Value::VT_date; 522 return CJS_Value::VT_date;
528 if (nHash == JSCONST_nObjectHash) 523 if (nHash == JSCONST_nObjectHash)
529 return CJS_Value::VT_object; 524 return CJS_Value::VT_object;
530 if (nHash == JSCONST_nFXobjHash) 525 if (nHash == JSCONST_nFXobjHash)
531 return CJS_Value::VT_fxobject; 526 return CJS_Value::VT_fxobject;
532 527
533 return CJS_Value::VT_unknown; 528 return CJS_Value::VT_unknown;
534 } 529 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/global.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698