summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-15 11:21:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-15 11:21:33 -0700
commit625ad667d0c0c17d5bc11d505f04861d90b45078 (patch)
treeefd014e752072adf726a0e34383555399342dcb2 /fpdfsdk/javascript
parent29b8ad0b130ec6ed4f72ebd0c0a4f9e6a5b03467 (diff)
downloadpdfium-625ad667d0c0c17d5bc11d505f04861d90b45078.tar.xz
Make code compile with clang_use_chrome_plugin (part IV)
This change mainly contains files in fpdfsdk/ directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups plus removing an unused file and splitting cxfa_eventparam out from fxfa.h BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2062313002
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Field.cpp7
-rw-r--r--fpdfsdk/javascript/Field.h4
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.cpp4
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h4
-rw-r--r--fpdfsdk/javascript/JS_Object.cpp12
-rw-r--r--fpdfsdk/javascript/JS_Object.h8
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp4
-rw-r--r--fpdfsdk/javascript/JS_Value.h2
-rw-r--r--fpdfsdk/javascript/cjs_context.cpp4
-rw-r--r--fpdfsdk/javascript/cjs_context.h6
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp4
-rw-r--r--fpdfsdk/javascript/cjs_runtime.h2
-rw-r--r--fpdfsdk/javascript/global.cpp12
-rw-r--r--fpdfsdk/javascript/global.h11
14 files changed, 63 insertions, 21 deletions
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index ecf4f5a7e2..8d7fe1b186 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -114,6 +114,13 @@ END_JS_STATIC_METHOD()
IMPLEMENT_JS_CLASS(CJS_Field, Field)
+CJS_DelayData::CJS_DelayData(FIELD_PROP prop,
+ int idx,
+ const CFX_WideString& name)
+ : eProp(prop), nControlIndex(idx), sFieldName(name) {}
+
+CJS_DelayData::~CJS_DelayData() {}
+
void CJS_Field::InitInstance(IJS_Runtime* pIRuntime) {
CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime);
Field* pField = static_cast<Field*>(GetEmbedObject());
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index f5a7e1b846..84bba6862d 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -54,8 +54,8 @@ enum FIELD_PROP {
};
struct CJS_DelayData {
- CJS_DelayData(FIELD_PROP prop, int idx, const CFX_WideString& name)
- : eProp(prop), nControlIndex(idx), sFieldName(name) {}
+ CJS_DelayData(FIELD_PROP prop, int idx, const CFX_WideString& name);
+ ~CJS_DelayData();
FIELD_PROP eProp;
int nControlIndex;
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index aaa25ff474..14c36530d5 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -453,3 +453,7 @@ void CJS_GlobalData::MakeByteString(const CFX_ByteString& name,
break;
}
}
+
+CJS_KeyValue::CJS_KeyValue() {}
+
+CJS_KeyValue::~CJS_KeyValue() {}
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index d9f4f0989b..8273c0838c 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -39,8 +39,8 @@ class CJS_GlobalVariableArray {
class CJS_KeyValue {
public:
- CJS_KeyValue() {}
- virtual ~CJS_KeyValue() {}
+ CJS_KeyValue();
+ virtual ~CJS_KeyValue();
CFX_ByteString sKey;
int nType; // 0:int 1:bool 2:string 3:obj
diff --git a/fpdfsdk/javascript/JS_Object.cpp b/fpdfsdk/javascript/JS_Object.cpp
index 6339bb7359..0d190a7fa4 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -75,6 +75,18 @@ void CJS_Object::Dispose() {
m_pV8Object.Reset();
}
+FX_BOOL CJS_Object::IsType(const FX_CHAR* sClassName) {
+ return TRUE;
+}
+
+CFX_ByteString CJS_Object::GetClassName() {
+ return "";
+}
+
+void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {}
+
+void CJS_Object::ExitInstance() {}
+
int CJS_Object::MsgBox(CPDFDoc_Environment* pApp,
const FX_WCHAR* swMsg,
const FX_WCHAR* swTitle,
diff --git a/fpdfsdk/javascript/JS_Object.h b/fpdfsdk/javascript/JS_Object.h
index 49c078d927..908645ce33 100644
--- a/fpdfsdk/javascript/JS_Object.h
+++ b/fpdfsdk/javascript/JS_Object.h
@@ -46,11 +46,11 @@ class CJS_Object {
void MakeWeak();
void Dispose();
- virtual FX_BOOL IsType(const FX_CHAR* sClassName) { return TRUE; }
- virtual CFX_ByteString GetClassName() { return ""; }
+ virtual FX_BOOL IsType(const FX_CHAR* sClassName);
+ virtual CFX_ByteString GetClassName();
- virtual void InitInstance(IJS_Runtime* pIRuntime) {}
- virtual void ExitInstance() {}
+ virtual void InitInstance(IJS_Runtime* pIRuntime);
+ virtual void ExitInstance();
v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); }
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 1b8964bd00..53d6d59833 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -82,6 +82,8 @@ CJS_Value::CJS_Value(CJS_Runtime* pRuntime, CJS_Array& array)
CJS_Value::~CJS_Value() {}
+CJS_Value::CJS_Value(const CJS_Value& other) = default;
+
void CJS_Value::Attach(v8::Local<v8::Value> pValue, Type t) {
m_pValue = pValue;
m_eType = t;
@@ -410,6 +412,8 @@ CJS_Array::CJS_Array(CJS_Runtime* pRuntime) : m_pJSRuntime(pRuntime) {}
CJS_Array::~CJS_Array() {}
+CJS_Array::CJS_Array(const CJS_Array& other) = default;
+
void CJS_Array::Attach(v8::Local<v8::Array> pArray) {
m_pArray = pArray;
}
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 8adec4b1d1..958c5e070e 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -46,6 +46,7 @@ class CJS_Value {
CJS_Value(CJS_Runtime* pRuntime, CJS_Array& array);
~CJS_Value();
+ CJS_Value(const CJS_Value& other);
void SetNull();
void Attach(v8::Local<v8::Value> pValue, Type t);
@@ -137,6 +138,7 @@ class CJS_Array {
public:
CJS_Array(CJS_Runtime* pRuntime);
virtual ~CJS_Array();
+ CJS_Array(const CJS_Array& other);
void Attach(v8::Local<v8::Array> pArray);
void GetElement(unsigned index, CJS_Value& value);
diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp
index b844dc6e5c..3833b166b6 100644
--- a/fpdfsdk/javascript/cjs_context.cpp
+++ b/fpdfsdk/javascript/cjs_context.cpp
@@ -268,6 +268,10 @@ void CJS_Context::OnExternal_Exec() {
m_pEventHandler->OnExternal_Exec();
}
+void CJS_Context::EnableMessageBox(FX_BOOL bEnable) {
+ m_bMsgBoxEnable = bEnable;
+}
+
void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) {
m_pEventHandler->OnBatchExec(pTarget);
}
diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h
index 64b97d616e..84fdf1d3e1 100644
--- a/fpdfsdk/javascript/cjs_context.h
+++ b/fpdfsdk/javascript/cjs_context.h
@@ -119,13 +119,13 @@ class CJS_Context : public IJS_Context {
void OnBatchExec(CPDFSDK_Document* pTarget) override;
void OnConsole_Exec() override;
void OnExternal_Exec() override;
- void EnableMessageBox(FX_BOOL bEnable) override { m_bMsgBoxEnable = bEnable; }
+ void EnableMessageBox(FX_BOOL bEnable) override;
FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; }
-
- CPDFDoc_Environment* GetReaderApp();
CJS_Runtime* GetJSRuntime() const { return m_pRuntime; }
CJS_EventHandler* GetEventHandler() const { return m_pEventHandler; }
+
+ CPDFDoc_Environment* GetReaderApp();
CPDFSDK_Document* GetReaderDocument();
private:
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index 020472e584..2bcdc2293b 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -210,6 +210,10 @@ void CJS_Runtime::SetReaderDocument(CPDFSDK_Document* pReaderDoc) {
}
}
+CPDFSDK_Document* CJS_Runtime::GetReaderDocument() {
+ return m_pDocument;
+}
+
int CJS_Runtime::Execute(const CFX_WideString& script, CFX_WideString* info) {
FXJSErr error = {};
int nRet = FXJS_Execute(m_isolate, script, &error);
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index 4181bd21c9..2668367c1b 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -42,7 +42,7 @@ class CJS_Runtime : public IJS_Runtime {
void ReleaseContext(IJS_Context* pContext) override;
IJS_Context* GetCurrentContext() override;
void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override;
- CPDFSDK_Document* GetReaderDocument() override { return m_pDocument; }
+ CPDFSDK_Document* GetReaderDocument() override;
int Execute(const CFX_WideString& script, CFX_WideString* info) override;
CPDFDoc_Environment* GetReaderApp() const { return m_pApp; }
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 32498e474c..c3fc548a73 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -93,6 +93,18 @@ void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) {
pGlobal->Initial(pRuntime->GetReaderApp());
}
+JSGlobalData::JSGlobalData()
+ : nType(0),
+ dData(0),
+ bData(FALSE),
+ sData(""),
+ bPersistent(FALSE),
+ bDeleted(FALSE) {}
+
+JSGlobalData::~JSGlobalData() {
+ pData.Reset();
+}
+
JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject)
: CJS_EmbedObj(pJSObject), m_pApp(nullptr) {}
diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h
index 02c51d98a9..eca9aa12d1 100644
--- a/fpdfsdk/javascript/global.h
+++ b/fpdfsdk/javascript/global.h
@@ -17,16 +17,9 @@ class CJS_GlobalVariableArray;
class CJS_KeyValue;
struct JSGlobalData {
- JSGlobalData() {
- nType = 0;
- dData = 0;
- bData = FALSE;
- sData = "";
- bPersistent = FALSE;
- bDeleted = FALSE;
- }
+ JSGlobalData();
+ ~JSGlobalData();
- ~JSGlobalData() { pData.Reset(); }
int nType; // 0:int 1:bool 2:string 3:obj
double dData;
bool bData;