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

Unified Diff: fpdfsdk/javascript/JS_GlobalData.h

Issue 1834203002: use std::vector in more places in JavaScript bindings code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@util_printx
Patch Set: Nits. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/Field.cpp ('k') | fpdfsdk/javascript/JS_GlobalData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/JS_GlobalData.h
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 24c0abf3ca63edcc191b248212534fc1bc839865..65bb921ad91c713ed527de1a75c55e3c82ec6074 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -7,6 +7,9 @@
#ifndef FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
#define FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
+#include <memory>
+#include <vector>
+
#include "core/fxcrt/include/fx_basic.h"
#define JS_GLOBALDATA_TYPE_NUMBER 0
@@ -77,6 +80,11 @@ class CJS_GlobalData {
CJS_GlobalData_Element* GetAt(int index) const;
private:
+ using iterator =
+ std::vector<std::unique_ptr<CJS_GlobalData_Element>>::iterator;
+ using const_iterator =
+ std::vector<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator;
+
static CJS_GlobalData* g_Instance;
CJS_GlobalData();
@@ -86,7 +94,8 @@ class CJS_GlobalData {
void SaveGlobalPersisitentVariables();
CJS_GlobalData_Element* GetGlobalVariable(const FX_CHAR* propname);
- int FindGlobalVariable(const FX_CHAR* propname);
+ iterator FindGlobalVariable(const FX_CHAR* propname);
+ const_iterator FindGlobalVariable(const FX_CHAR* propname) const;
void LoadFileBuffer(const FX_WCHAR* sFilePath,
uint8_t*& pBuffer,
@@ -99,7 +108,7 @@ class CJS_GlobalData {
CFX_BinaryBuf& sData);
size_t m_RefCount;
- CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
+ std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData;
CFX_WideString m_sFilePath;
};
« no previous file with comments | « fpdfsdk/javascript/Field.cpp ('k') | fpdfsdk/javascript/JS_GlobalData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698