summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Value.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-23 09:44:30 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-23 17:57:28 +0000
commit33d13f2231a07e7b32ff25da6a6a28cb619d18a9 (patch)
tree8be1d6a857dff58d8aacbc1dc722fceac8343235 /fpdfsdk/javascript/JS_Value.h
parentc970895f94cf76eb738d0a583ae139fecdd85268 (diff)
downloadpdfium-33d13f2231a07e7b32ff25da6a6a28cb619d18a9.tar.xz
Remove CJS_PropValue
This CL removes the CJS_PropValue class and uses CJS_Value directly. The various Set methods have been moved to CJS_Value and the runtime provided as needed. Change-Id: Ib5d3b9efc9b6cf8182be8f19af98599379c3d7db Reviewed-on: https://pdfium-review.googlesource.com/16431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.h')
-rw-r--r--fpdfsdk/javascript/JS_Value.h67
1 files changed, 13 insertions, 54 deletions
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 3631dbe6a1..49dd2492da 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -36,7 +36,6 @@ class CJS_Value {
CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue);
CJS_Value(CJS_Runtime* pRuntime, int iValue);
CJS_Value(CJS_Runtime* pRuntime, double dValue);
- CJS_Value(CJS_Runtime* pRuntime, float fValue);
CJS_Value(CJS_Runtime* pRuntime, bool bValue);
CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj);
CJS_Value(CJS_Runtime* pRuntime, const char* pStr);
@@ -48,8 +47,19 @@ class CJS_Value {
~CJS_Value();
+ // These calls may re-enter JS (and hence invalidate objects).
+ void Set(CJS_Runtime* pRuntime, int val);
+ void Set(CJS_Runtime* pRuntime, bool val);
+ void Set(CJS_Runtime* pRuntime, double val);
+ void Set(CJS_Runtime* pRuntime, CJS_Object* pObj);
+ void Set(CJS_Runtime* pRuntime, CJS_Document* pJsDoc);
+ void Set(CJS_Runtime* pRuntime, const ByteString&);
+ void Set(CJS_Runtime* pRuntime, const WideString&);
+ void Set(CJS_Runtime* pRuntime, const wchar_t* c_string);
+ void Set(CJS_Runtime* pRuntime, const CJS_Array& array);
+ void Set(CJS_Runtime* pRuntime, const CJS_Date& date);
+ void Set(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue);
void SetNull(CJS_Runtime* pRuntime);
- void Set(v8::Local<v8::Value> pValue);
Type GetType() const { return GetValueType(m_pValue); }
@@ -58,6 +68,7 @@ class CJS_Value {
double ToDouble(CJS_Runtime* pRuntime) const;
float ToFloat(CJS_Runtime* pRuntime) const;
CJS_Object* ToObject(CJS_Runtime* pRuntime) const;
+ CJS_Document* ToDocument(CJS_Runtime* pRuntime) const;
CJS_Array ToArray(CJS_Runtime* pRuntime) const;
CJS_Date ToDate(CJS_Runtime* pRuntime) const;
WideString ToWideString(CJS_Runtime* pRuntime) const;
@@ -77,58 +88,6 @@ class CJS_Value {
v8::Local<v8::Value> m_pValue;
};
-class CJS_PropValue {
- public:
- explicit CJS_PropValue(CJS_Runtime* pRuntime);
- CJS_PropValue(CJS_Runtime* pRuntime, const CJS_Value&);
- ~CJS_PropValue();
-
- void StartSetting() { m_bIsSetting = true; }
- void StartGetting() { m_bIsSetting = false; }
- bool IsSetting() const { return m_bIsSetting; }
- bool IsGetting() const { return !m_bIsSetting; }
- CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime.Get(); }
- CJS_Value* GetJSValue() { return &m_Value; }
- const CJS_Value* GetJSValue() const { return &m_Value; }
-
- // These calls may re-enter JS (and hence invalidate objects).
- void Set(int val);
- int ToInt() const;
-
- void Set(bool val);
- bool ToBool() const;
-
- void Set(double val);
- double ToDouble() const;
-
- void Set(CJS_Object* pObj);
- CJS_Object* ToObject() const;
-
- void Set(CJS_Document* pJsDoc);
- CJS_Document* ToDocument() const;
-
- void Set(const ByteString&);
- ByteString ToByteString() const;
-
- void Set(const WideString&);
- void Set(const wchar_t* c_string);
- WideString ToWideString() const;
-
- void Set(v8::Local<v8::Object>);
- v8::Local<v8::Object> ToV8Object() const;
-
- void Set(const CJS_Array& array);
- CJS_Array ToArray() const;
-
- void Set(const CJS_Date& date);
- CJS_Date ToDate() const;
-
- private:
- bool m_bIsSetting;
- CJS_Value m_Value;
- UnownedPtr<CJS_Runtime> const m_pJSRuntime;
-};
-
class CJS_Array {
public:
CJS_Array();