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

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

Issue 1398703009: Next round of XFA changes to match master (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 "JS_GlobalData.h" 7 #include "JS_GlobalData.h"
8 8
9 #include "../../../core/include/fdrm/fx_crypt.h" 9 #include "../../../core/include/fdrm/fx_crypt.h"
10 #include "../../include/javascript/IJavaScript.h" 10 #include "../../include/javascript/IJavaScript.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return g_Instance; 110 return g_Instance;
111 } 111 }
112 112
113 void CJS_GlobalData::Release() { 113 void CJS_GlobalData::Release() {
114 if (!--m_RefCount) { 114 if (!--m_RefCount) {
115 delete g_Instance; 115 delete g_Instance;
116 g_Instance = nullptr; 116 g_Instance = nullptr;
117 } 117 }
118 } 118 }
119 119
120 CJS_GlobalData::CJS_GlobalData(CPDFDoc_Environment* pApp) 120 CJS_GlobalData::CJS_GlobalData(CPDFDoc_Environment* pApp) : m_RefCount(0) {
Lei Zhang 2015/10/14 21:02:27 Why bother even passing in |pApp| then?
121 : m_pApp(pApp), m_RefCount(0) {
122 m_sFilePath += SDK_JS_GLOBALDATA_FILENAME; 121 m_sFilePath += SDK_JS_GLOBALDATA_FILENAME;
123 LoadGlobalPersistentVariables(); 122 LoadGlobalPersistentVariables();
124 } 123 }
125 124
126 CJS_GlobalData::~CJS_GlobalData() { 125 CJS_GlobalData::~CJS_GlobalData() {
127 SaveGlobalPersisitentVariables(); 126 SaveGlobalPersisitentVariables();
128 for (int i = 0, sz = m_arrayGlobalData.GetSize(); i < sz; i++) 127 for (int i = 0, sz = m_arrayGlobalData.GetSize(); i < sz; i++)
129 delete m_arrayGlobalData.GetAt(i); 128 delete m_arrayGlobalData.GetAt(i);
130 129
131 m_arrayGlobalData.RemoveAll(); 130 m_arrayGlobalData.RemoveAll();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 case JS_GLOBALDATA_TYPE_NULL: { 489 case JS_GLOBALDATA_TYPE_NULL: {
491 FX_DWORD dwNameLen = (FX_DWORD)name.GetLength(); 490 FX_DWORD dwNameLen = (FX_DWORD)name.GetLength();
492 sData.AppendBlock(&dwNameLen, sizeof(FX_DWORD)); 491 sData.AppendBlock(&dwNameLen, sizeof(FX_DWORD));
493 sData.AppendString(name); 492 sData.AppendString(name);
494 sData.AppendBlock(&wType, sizeof(FX_DWORD)); 493 sData.AppendBlock(&wType, sizeof(FX_DWORD));
495 } break; 494 } break;
496 default: 495 default:
497 break; 496 break;
498 } 497 }
499 } 498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698