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

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

Issue 2354413002: Rename App to Env where needed. (Closed)
Patch Set: Rebase to master Created 4 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/javascript/global.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 "fpdfsdk/javascript/global.h" 7 #include "fpdfsdk/javascript/global.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 BEGIN_JS_STATIC_METHOD(CJS_Global) 26 BEGIN_JS_STATIC_METHOD(CJS_Global)
27 JS_STATIC_METHOD_ENTRY(setPersistent) 27 JS_STATIC_METHOD_ENTRY(setPersistent)
28 END_JS_STATIC_METHOD() 28 END_JS_STATIC_METHOD()
29 29
30 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); 30 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global);
31 31
32 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { 32 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) {
33 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); 33 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime);
34 JSGlobalAlternate* pGlobal = 34 JSGlobalAlternate* pGlobal =
35 static_cast<JSGlobalAlternate*>(GetEmbedObject()); 35 static_cast<JSGlobalAlternate*>(GetEmbedObject());
36 pGlobal->Initial(pRuntime->GetReaderApp()); 36 pGlobal->Initial(pRuntime->GetReaderEnv());
37 } 37 }
38 38
39 JSGlobalData::JSGlobalData() 39 JSGlobalData::JSGlobalData()
40 : nType(JS_GlobalDataType::NUMBER), 40 : nType(JS_GlobalDataType::NUMBER),
41 dData(0), 41 dData(0),
42 bData(FALSE), 42 bData(FALSE),
43 sData(""), 43 sData(""),
44 bPersistent(FALSE), 44 bPersistent(FALSE),
45 bDeleted(FALSE) {} 45 bDeleted(FALSE) {}
46 46
47 JSGlobalData::~JSGlobalData() { 47 JSGlobalData::~JSGlobalData() {
48 pData.Reset(); 48 pData.Reset();
49 } 49 }
50 50
51 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) 51 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject)
52 : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {} 52 : CJS_EmbedObj(pJSObject), m_pEnv(nullptr) {}
53 53
54 JSGlobalAlternate::~JSGlobalAlternate() { 54 JSGlobalAlternate::~JSGlobalAlternate() {
55 DestroyGlobalPersisitentVariables(); 55 DestroyGlobalPersisitentVariables();
56 m_pGlobalData->Release(); 56 m_pGlobalData->Release();
57 } 57 }
58 58
59 void JSGlobalAlternate::Initial(CPDFSDK_Environment* pApp) { 59 void JSGlobalAlternate::Initial(CPDFSDK_Environment* pEnv) {
60 m_pApp = pApp; 60 m_pEnv = pEnv;
61 m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pApp); 61 m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pEnv);
62 UpdateGlobalPersistentVariables(); 62 UpdateGlobalPersistentVariables();
63 } 63 }
64 64
65 FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { 65 FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) {
66 return CFX_WideString(propname) != L"setPersistent"; 66 return CFX_WideString(propname) != L"setPersistent";
67 } 67 }
68 68
69 FX_BOOL JSGlobalAlternate::DelProperty(IJS_Context* cc, 69 FX_BOOL JSGlobalAlternate::DelProperty(IJS_Context* cc,
70 const FX_WCHAR* propname, 70 const FX_WCHAR* propname,
71 CFX_WideString& sError) { 71 CFX_WideString& sError) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 pNewData->nType = JS_GlobalDataType::NULLOBJ; 433 pNewData->nType = JS_GlobalDataType::NULLOBJ;
434 pNewData->bPersistent = bDefaultPersistent; 434 pNewData->bPersistent = bDefaultPersistent;
435 } break; 435 } break;
436 default: 436 default:
437 return FALSE; 437 return FALSE;
438 } 438 }
439 439
440 m_mapGlobal[propname] = pNewData; 440 m_mapGlobal[propname] = pNewData;
441 return TRUE; 441 return TRUE;
442 } 442 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/global.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698