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

Side by Side Diff: fpdfsdk/javascript/JS_GlobalData.h

Issue 2154843002: Clean up singleton implementation (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 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 #ifndef FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ 7 #ifndef FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
8 #define FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ 8 #define FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 int32_t GetSize() const; 78 int32_t GetSize() const;
79 CJS_GlobalData_Element* GetAt(int index) const; 79 CJS_GlobalData_Element* GetAt(int index) const;
80 80
81 private: 81 private:
82 using iterator = 82 using iterator =
83 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::iterator; 83 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::iterator;
84 using const_iterator = 84 using const_iterator =
85 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator; 85 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator;
86 86
87 static CJS_GlobalData* g_Instance; 87 static CJS_GlobalData* m_pInstance;
Lei Zhang 2016/07/16 01:23:03 s_ for static?
Wei Li 2016/07/18 19:07:07 Done.
88 88
89 CJS_GlobalData(); 89 CJS_GlobalData();
90 ~CJS_GlobalData(); 90 ~CJS_GlobalData();
91 91
92 void LoadGlobalPersistentVariables(); 92 void LoadGlobalPersistentVariables();
93 void SaveGlobalPersisitentVariables(); 93 void SaveGlobalPersisitentVariables();
94 94
95 CJS_GlobalData_Element* GetGlobalVariable(const CFX_ByteString& sPropname); 95 CJS_GlobalData_Element* GetGlobalVariable(const CFX_ByteString& sPropname);
96 iterator FindGlobalVariable(const CFX_ByteString& sPropname); 96 iterator FindGlobalVariable(const CFX_ByteString& sPropname);
97 const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const; 97 const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const;
98 98
99 void LoadFileBuffer(const FX_WCHAR* sFilePath, 99 void LoadFileBuffer(const FX_WCHAR* sFilePath,
100 uint8_t*& pBuffer, 100 uint8_t*& pBuffer,
101 int32_t& nLength); 101 int32_t& nLength);
102 void WriteFileBuffer(const FX_WCHAR* sFilePath, 102 void WriteFileBuffer(const FX_WCHAR* sFilePath,
103 const FX_CHAR* pBuffer, 103 const FX_CHAR* pBuffer,
104 int32_t nLength); 104 int32_t nLength);
105 void MakeByteString(const CFX_ByteString& name, 105 void MakeByteString(const CFX_ByteString& name,
106 CJS_KeyValue* pData, 106 CJS_KeyValue* pData,
107 CFX_BinaryBuf& sData); 107 CFX_BinaryBuf& sData);
108 108
109 size_t m_RefCount; 109 size_t m_RefCount;
110 std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData; 110 std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData;
111 CFX_WideString m_sFilePath; 111 CFX_WideString m_sFilePath;
112 }; 112 };
113 113
114 #endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ 114 #endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698