From e49749265c4e503c37a316e4ca6eeff430d13b87 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 24 Oct 2017 09:36:16 -0400 Subject: Remove most CJS_Value Set methods This CL removes all of the Set(*) methods from CJS_Value except for Set(v8::Local). All uses of Set are changed to convert to a v8::Value before setting. Change-Id: I6e4d2cebec42fce5c039dc0a3abe46086cfdd34f Reviewed-on: https://pdfium-review.googlesource.com/16610 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fpdfsdk/javascript/JS_Value.h | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'fpdfsdk/javascript/JS_Value.h') diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h index 49dd2492da..72d381e188 100644 --- a/fpdfsdk/javascript/JS_Value.h +++ b/fpdfsdk/javascript/JS_Value.h @@ -32,34 +32,22 @@ class CJS_Value { static Type GetValueType(v8::Local value); - explicit CJS_Value(CJS_Runtime* pRuntime); - CJS_Value(CJS_Runtime* pRuntime, v8::Local pValue); + CJS_Value(); + explicit CJS_Value(v8::Local pValue); CJS_Value(CJS_Runtime* pRuntime, int iValue); CJS_Value(CJS_Runtime* pRuntime, double dValue); CJS_Value(CJS_Runtime* pRuntime, bool bValue); - CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj); + explicit CJS_Value(CJS_Object* pObj); CJS_Value(CJS_Runtime* pRuntime, const char* pStr); CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr); CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array); - CJS_Value(CJS_Runtime* pRuntime, const CJS_Date& date); - CJS_Value(CJS_Runtime* pRuntime, const CJS_Object* object); + explicit CJS_Value(const CJS_Date& date); CJS_Value(const CJS_Value& other); ~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 pValue); - void SetNull(CJS_Runtime* pRuntime); + void Set(v8::Local pValue); Type GetType() const { return GetValueType(m_pValue); } @@ -70,12 +58,12 @@ class CJS_Value { 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; + CJS_Date ToDate() const; WideString ToWideString(CJS_Runtime* pRuntime) const; ByteString ToByteString(CJS_Runtime* pRuntime) const; v8::Local ToV8Object(CJS_Runtime* pRuntime) const; v8::Local ToV8Array(CJS_Runtime* pRuntime) const; - v8::Local ToV8Value(CJS_Runtime* pRuntime) const; + v8::Local ToV8Value() const; // Replace the current |m_pValue| with a v8::Number if possible // to make one from the current |m_pValue|. @@ -133,7 +121,7 @@ class CJS_Date { int GetMinutes(CJS_Runtime* pRuntime) const; int GetSeconds(CJS_Runtime* pRuntime) const; - v8::Local ToV8Date(CJS_Runtime* pRuntime) const; + v8::Local ToV8Date() const; WideString ToWideString(int style) const; protected: -- cgit v1.2.3