summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Value.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-08 12:04:40 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-08 12:04:40 -0700
commit287b63d9ab410783d71cf37291f09fd57d3059b4 (patch)
treef7694e057d86f98833830ea1a34c2a2bbdca8399 /fpdfsdk/src/javascript/JS_Value.h
parent4fa0e27ba39f49ba92fb4c160ab836a6f1dd2893 (diff)
downloadpdfium-287b63d9ab410783d71cf37291f09fd57d3059b4.tar.xz
Wean CJS_Value off of v8::Isolate.
CJS_Values should belong to CJS_Runtimes so that we may eventually cram much of the v8 dependencies down into fxjs. This is a first step; the remaining split in this code between isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't happen until this is resolved. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394103002 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Value.h')
-rw-r--r--fpdfsdk/src/javascript/JS_Value.h51
1 files changed, 26 insertions, 25 deletions
diff --git a/fpdfsdk/src/javascript/JS_Value.h b/fpdfsdk/src/javascript/JS_Value.h
index fdcc66279f..d64fdc6a11 100644
--- a/fpdfsdk/src/javascript/JS_Value.h
+++ b/fpdfsdk/src/javascript/JS_Value.h
@@ -14,6 +14,7 @@ class CJS_Array;
class CJS_Date;
class CJS_Document;
class CJS_Object;
+class CJS_Runtime;
class CJS_Value {
public:
@@ -29,18 +30,18 @@ class CJS_Value {
VT_undefined
};
- CJS_Value(v8::Isolate* isolate);
- CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue, Type t);
- CJS_Value(v8::Isolate* isolate, const int& iValue);
- CJS_Value(v8::Isolate* isolate, const double& dValue);
- CJS_Value(v8::Isolate* isolate, const float& fValue);
- CJS_Value(v8::Isolate* isolate, const bool& bValue);
- CJS_Value(v8::Isolate* isolate, v8::Local<v8::Object>);
- CJS_Value(v8::Isolate* isolate, CJS_Object*);
- CJS_Value(v8::Isolate* isolate, CJS_Document*);
- CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr);
- CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr);
- CJS_Value(v8::Isolate* isolate, CJS_Array& array);
+ CJS_Value(CJS_Runtime* pRuntime);
+ CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue, Type t);
+ CJS_Value(CJS_Runtime* pRuntime, const int& iValue);
+ CJS_Value(CJS_Runtime* pRuntime, const double& dValue);
+ CJS_Value(CJS_Runtime* pRuntime, const float& fValue);
+ CJS_Value(CJS_Runtime* pRuntime, const bool& bValue);
+ CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Object>);
+ CJS_Value(CJS_Runtime* pRuntime, CJS_Object*);
+ CJS_Value(CJS_Runtime* pRuntime, CJS_Document*);
+ CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr);
+ CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr);
+ CJS_Value(CJS_Runtime* pRuntime, CJS_Array& array);
~CJS_Value();
@@ -79,12 +80,12 @@ class CJS_Value {
FX_BOOL ConvertToArray(CJS_Array&) const;
FX_BOOL ConvertToDate(CJS_Date&) const;
- v8::Isolate* GetIsolate() { return m_isolate; }
+ CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; }
protected:
Type m_eType;
v8::Local<v8::Value> m_pValue;
- v8::Isolate* m_isolate;
+ CJS_Runtime* m_pJSRuntime;
};
class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value> {
@@ -98,12 +99,12 @@ class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value> {
class CJS_PropValue : public CJS_Value {
public:
CJS_PropValue(const CJS_Value&);
- CJS_PropValue(v8::Isolate* isolate);
+ CJS_PropValue(CJS_Runtime* pRuntime);
~CJS_PropValue();
- public:
- FX_BOOL IsSetting();
- FX_BOOL IsGetting();
+ FX_BOOL IsSetting() const { return m_bIsSetting; }
+ FX_BOOL IsGetting() const { return !m_bIsSetting; }
+
void operator<<(int);
void operator>>(int&) const;
void operator<<(bool);
@@ -135,7 +136,7 @@ class CJS_PropValue : public CJS_Value {
class CJS_Array {
public:
- CJS_Array(v8::Isolate* isolate);
+ CJS_Array(CJS_Runtime* pRuntime);
virtual ~CJS_Array();
void Attach(v8::Local<v8::Array> pArray);
@@ -145,20 +146,20 @@ class CJS_Array {
FX_BOOL IsAttached();
operator v8::Local<v8::Array>();
- v8::Isolate* GetIsolate() { return m_isolate; }
+ CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; }
private:
v8::Local<v8::Array> m_pArray;
- v8::Isolate* m_isolate;
+ CJS_Runtime* m_pJSRuntime;
};
class CJS_Date {
friend class CJS_Value;
public:
- CJS_Date(v8::Isolate* isolate);
- CJS_Date(v8::Isolate* isolate, double dMsec_time);
- CJS_Date(v8::Isolate* isolate,
+ CJS_Date(CJS_Runtime* pRuntime);
+ CJS_Date(CJS_Runtime* pRuntime, double dMsec_time);
+ CJS_Date(CJS_Runtime* pRuntime,
int year,
int mon,
int day,
@@ -198,7 +199,7 @@ class CJS_Date {
protected:
v8::Local<v8::Value> m_pDate;
- v8::Isolate* m_isolate;
+ CJS_Runtime* m_pJSRuntime;
};
double JS_GetDateTime();