diff options
author | tsepez <tsepez@chromium.org> | 2017-01-18 14:38:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-18 14:38:18 -0800 |
commit | e6cf01356e3336dc4f0717a391d9067693a418c1 (patch) | |
tree | a8d8c2cec202be753b3d558e320cf981c6983bb8 /fxjs/fxjs_v8.h | |
parent | 85c532b35b53836bebfdb8f8832905d5f313cf47 (diff) | |
download | pdfium-e6cf01356e3336dc4f0717a391d9067693a418c1.tar.xz |
Tidy FXJS_V8, backfill tests.chromium/2986
Move checks performed as part of JS_Value's object and array
handling back into FXJS, to ease removal of JS_Value in the future.
Remove some convenience routines in FXJS for objects, to shrink
API to be covered during testing.
Change some naming (number => double, string => widestring) to
make it clearer when there is a C++ type involved.
BUG=
Review-Url: https://codereview.chromium.org/2637503002
Diffstat (limited to 'fxjs/fxjs_v8.h')
-rw-r--r-- | fxjs/fxjs_v8.h | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h index ba729626f2..6cf3ca578e 100644 --- a/fxjs/fxjs_v8.h +++ b/fxjs/fxjs_v8.h @@ -176,6 +176,7 @@ class CFXJS_Engine { v8::Local<v8::Context> NewLocalContext(); v8::Local<v8::Context> GetPersistentContext(); + v8::Local<v8::Object> GetThisObj(); v8::Local<v8::Value> NewNull(); v8::Local<v8::Array> NewArray(); @@ -183,18 +184,18 @@ class CFXJS_Engine { v8::Local<v8::Value> NewNumber(double number); v8::Local<v8::Value> NewNumber(float number); v8::Local<v8::Value> NewBoolean(bool b); - v8::Local<v8::Value> NewString(const wchar_t* str); + v8::Local<v8::Value> NewString(const CFX_WideString& str); v8::Local<v8::Date> NewDate(double d); v8::Local<v8::Object> NewFxDynamicObj(int nObjDefnID, bool bStatic = false); - v8::Local<v8::Object> GetThisObj(); int ToInt32(v8::Local<v8::Value> pValue); bool ToBoolean(v8::Local<v8::Value> pValue); - double ToNumber(v8::Local<v8::Value> pValue); - CFX_WideString ToString(v8::Local<v8::Value> pValue); + double ToDouble(v8::Local<v8::Value> pValue); + CFX_WideString ToWideString(v8::Local<v8::Value> pValue); v8::Local<v8::Object> ToObject(v8::Local<v8::Value> pValue); v8::Local<v8::Array> ToArray(v8::Local<v8::Value> pValue); + // Arrays. unsigned GetArrayLength(v8::Local<v8::Array> pArray); v8::Local<v8::Value> GetArrayElement(v8::Local<v8::Array> pArray, unsigned index); @@ -202,31 +203,14 @@ class CFXJS_Engine { unsigned index, v8::Local<v8::Value> pValue); + // Objects. std::vector<CFX_WideString> GetObjectPropertyNames( v8::Local<v8::Object> pObj); v8::Local<v8::Value> GetObjectProperty(v8::Local<v8::Object> pObj, const CFX_WideString& PropertyName); - - void PutObjectString(v8::Local<v8::Object> pObj, - const CFX_WideString& wsPropertyName, - const CFX_WideString& wsValue); - void PutObjectNumber(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName, - int nValue); - void PutObjectNumber(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName, - float fValue); - void PutObjectNumber(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName, - double dValue); - void PutObjectBoolean(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName, - bool bValue); - void PutObjectObject(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName, - v8::Local<v8::Object> pPut); - void PutObjectNull(v8::Local<v8::Object> pObj, - const CFX_WideString& PropertyName); + void PutObjectProperty(v8::Local<v8::Object> pObj, + const CFX_WideString& PropertyName, + v8::Local<v8::Value> pValue); // Native object binding. void SetObjectPrivate(v8::Local<v8::Object> pObj, void* p); |