summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_GlobalData.h
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-03-28 16:59:30 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-28 16:59:30 -0700
commit41a53ad771411db3cdd98822f9d240456767fba8 (patch)
tree55ba380c593da9d1c0b8a42bec0ed949b1b29b78 /fpdfsdk/javascript/JS_GlobalData.h
parent4f1f41f338ce0899e48605c82375a72883f4eb7c (diff)
downloadpdfium-41a53ad771411db3cdd98822f9d240456767fba8.tar.xz
use std::vector in more places in JavaScript bindings code.
use unique_ptrs for app:m_Timers. BUG= Review URL: https://codereview.chromium.org/1834203002
Diffstat (limited to 'fpdfsdk/javascript/JS_GlobalData.h')
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 24c0abf3ca..65bb921ad9 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;
};