From cc3727f88e48f4d26a589131dc03adca4eaac301 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 5 Jan 2016 16:20:04 -0800 Subject: Replace IconTree class with std::list. Remove some O(n^2) behaviour when iterating across the thing. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1566433003 . --- fpdfsdk/src/javascript/Document.h | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'fpdfsdk/src/javascript/Document.h') diff --git a/fpdfsdk/src/javascript/Document.h b/fpdfsdk/src/javascript/Document.h index 3e957a6057..350ab05682 100644 --- a/fpdfsdk/src/javascript/Document.h +++ b/fpdfsdk/src/javascript/Document.h @@ -7,6 +7,9 @@ #ifndef FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_ #define FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_ +#include +#include + #include "JS_Define.h" class PrintParamsObj : public CJS_EmbedObj { @@ -37,31 +40,13 @@ class Icon; class Field; struct IconElement { - IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {} - virtual ~IconElement() {} + IconElement(const CFX_WideString& name, Icon* stream) + : IconName(name), IconStream(stream) {} + CFX_WideString IconName; - IconElement* NextIcon; Icon* IconStream; }; -class IconTree { - public: - IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {} - - virtual ~IconTree() {} - - public: - void InsertIconElement(IconElement* pNewIcon); - void DeleteIconTree(); - int GetLength(); - IconElement* operator[](int iIndex); - - private: - IconElement* m_pHead; - IconElement* m_pEnd; - int m_iLength; -}; - struct CJS_DelayData; struct CJS_DelayAnnot; struct CJS_AnnotObj; @@ -295,7 +280,7 @@ class Document : public CJS_EmbedObj { CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); v8::Isolate* m_isolate; - IconTree* m_pIconTree; + std::list> m_IconList; CPDFSDK_Document* m_pDocument; CFX_WideString m_cwBaseURL; bool m_bDelay; -- cgit v1.2.3