diff options
author | Jochen Eisinger <jochen@chromium.org> | 2015-05-19 00:38:00 +0200 |
---|---|---|
committer | Jochen Eisinger <jochen@chromium.org> | 2015-05-19 00:38:00 +0200 |
commit | dfa2c9939a85ad1c01ef858b21942ab3773dcf27 (patch) | |
tree | 064ae26fd633fe7ffcc6c72ce59bd2cfdd429246 /xfa | |
parent | 34d839653f3c7a821dadb8e3219f9a8da83d83e6 (diff) | |
download | pdfium-dfa2c9939a85ad1c01ef858b21942ab3773dcf27.tar.xz |
Merge V8 API updates to xfa branch
Set pointers in internal fields directly instead of wrapping them
Review URL: https://codereview.chromium.org/1139853003
Use phantom handles instead of weak handles
Review URL: https://codereview.chromium.org/1129253004
Replace deprecated with non-deprecated V8 APIs
Review URL: https://codereview.chromium.org/1126203010
Add myself to OWNERS file
Review URL: https://codereview.chromium.org/1133333005
Replace v8::Handle with v8::Local and v8::Persistent with v8::Global
Review URL: https://codereview.chromium.org/1138823004
TBR=tsepez@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1140033004
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fxjse/src/class.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fxjse/src/class.h | 4 | ||||
-rw-r--r-- | xfa/src/fxjse/src/context.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxjse/src/context.h | 4 | ||||
-rw-r--r-- | xfa/src/fxjse/src/dynprop.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxjse/src/runtime.h | 4 | ||||
-rw-r--r-- | xfa/src/fxjse/src/util_inline.h | 2 | ||||
-rw-r--r-- | xfa/src/fxjse/src/value.cpp | 12 | ||||
-rw-r--r-- | xfa/src/fxjse/src/value.h | 4 |
9 files changed, 25 insertions, 25 deletions
diff --git a/xfa/src/fxjse/src/class.cpp b/xfa/src/fxjse/src/class.cpp index 326e8d47c2..e29d4ce306 100644 --- a/xfa/src/fxjse/src/class.cpp +++ b/xfa/src/fxjse/src/class.cpp @@ -21,7 +21,7 @@ void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, const FXJSE_FUNCTION* lpFunc ASSERT(lpContext);
CFXJSE_ScopeUtil_IsolateHandleContext scope(lpContext);
v8::Isolate *pIsolate = lpContext->GetRuntime();
- v8::Handle<v8::Object> hGlobalObject = FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext());
+ v8::Local<v8::Object> hGlobalObject = FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext());
for(FX_INT32 i = 0; i < nNum; i++) {
hGlobalObject->ForceSet(v8::String::NewFromUtf8(pIsolate, lpFunctions[i].name),
v8::Function::New(pIsolate, FXJSE_V8FunctionCallback_Wrapper, v8::External::New(pIsolate, const_cast<FXJSE_FUNCTION*>(lpFunctions + i))),
@@ -164,14 +164,14 @@ FX_FLOAT CFXJSE_Arguments::GetFloat(FX_INT32 index) const CFX_ByteString CFXJSE_Arguments::GetUTF8String(FX_INT32 index) const
{
const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);
- v8::Handle<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString();
+ v8::Local<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString();
v8::String::Utf8Value szStringVal(hString);
return CFX_ByteString(*szStringVal);
}
FX_LPVOID CFXJSE_Arguments::GetObject(FX_INT32 index, FXJSE_HCLASS hClass ) const
{
const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);
- v8::Handle<v8::Value> hValue = (*lpArguments->m_pInfo)[index];
+ v8::Local<v8::Value> hValue = (*lpArguments->m_pInfo)[index];
ASSERT(!hValue.IsEmpty());
if(!hValue->IsObject()) {
return NULL;
diff --git a/xfa/src/fxjse/src/class.h b/xfa/src/fxjse/src/class.h index 26ebb91bfa..f8cdc34022 100644 --- a/xfa/src/fxjse/src/class.h +++ b/xfa/src/fxjse/src/class.h @@ -17,7 +17,7 @@ public: {
return m_pContext;
}
- inline v8::Persistent<v8::FunctionTemplate>& GetTemplate()
+ inline v8::Global<v8::FunctionTemplate>& GetTemplate()
{
return m_hTemplate;
}
@@ -29,7 +29,7 @@ public: protected:
CFX_ByteString m_szClassName;
CFXJSE_Context* m_pContext;
- v8::Persistent<v8::FunctionTemplate> m_hTemplate;
+ v8::Global<v8::FunctionTemplate> m_hTemplate;
friend class CFXJSE_Context;
friend class CFXJSE_Value;
};
diff --git a/xfa/src/fxjse/src/context.cpp b/xfa/src/fxjse/src/context.cpp index f2d979ee55..d78729fc35 100644 --- a/xfa/src/fxjse/src/context.cpp +++ b/xfa/src/fxjse/src/context.cpp @@ -63,12 +63,12 @@ FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, FX_LPCSTR szScript, FXJSE_H ASSERT(pContext);
return pContext->ExecuteScript(szScript, reinterpret_cast<CFXJSE_Value*>(hRetValue), reinterpret_cast<CFXJSE_Value*>(hNewThisObject));
}
-v8::Handle<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch)
+v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch)
{
- v8::Handle<v8::Object> hReturnValue = v8::Object::New(pIsolate);
+ v8::Local<v8::Object> hReturnValue = v8::Object::New(pIsolate);
if (trycatch.HasCaught()) {
- v8::Handle<v8::Value> hException = trycatch.Exception();
- v8::Handle<v8::Message> hMessage = trycatch.Message();
+ v8::Local<v8::Value> hException = trycatch.Exception();
+ v8::Local<v8::Message> hMessage = trycatch.Message();
if (hException->IsObject()) {
v8::Local<v8::Value> hValue;
hValue = hException.As<v8::Object>()->Get(v8::String::NewFromUtf8(pIsolate, "name"));
@@ -207,7 +207,7 @@ FX_BOOL CFXJSE_Context::ExecuteScript(FX_LPCSTR szScript, CFXJSE_Value* lpRetVal ASSERT(hWrapperValue->IsFunction());
v8::Local<v8::Function> hWrapperFn = hWrapperValue.As<v8::Function>();
if(!trycatch.HasCaught()) {
- v8::Handle<v8::Value> rgArgs[] = {hScriptString};
+ v8::Local<v8::Value> rgArgs[] = {hScriptString};
v8::Local<v8::Value> hValue = hWrapperFn->Call(hNewThis.As<v8::Object>(), 1, rgArgs);
if(!trycatch.HasCaught()) {
if(lpRetValue) {
diff --git a/xfa/src/fxjse/src/context.h b/xfa/src/fxjse/src/context.h index 8d3300150f..973536932b 100644 --- a/xfa/src/fxjse/src/context.h +++ b/xfa/src/fxjse/src/context.h @@ -26,12 +26,12 @@ protected: CFXJSE_Context(const CFXJSE_Context&);
CFXJSE_Context& operator = (const CFXJSE_Context&);
protected:
- v8::Persistent<v8::Context> m_hContext;
+ v8::Global<v8::Context> m_hContext;
v8::Isolate* m_pIsolate;
CFX_ArrayTemplate<CFXJSE_Class*> m_rgClasses;
friend class CFXJSE_Class;
friend class CFXJSE_ScopeUtil_IsolateHandleContext;
friend class CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext;
};
-v8::Handle<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch);
+v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch);
#endif
diff --git a/xfa/src/fxjse/src/dynprop.cpp b/xfa/src/fxjse/src/dynprop.cpp index fd03dcf6fd..ddc3e20054 100644 --- a/xfa/src/fxjse/src/dynprop.cpp +++ b/xfa/src/fxjse/src/dynprop.cpp @@ -146,7 +146,7 @@ static void FXJSE_V8ProxyCallback_getPropertyDescriptor (const v8::FunctionCall v8::Local<v8::Script> fnSource = v8::Script::Compile(v8::String::NewFromUtf8(pIsolate,
"(function (o, name) { var fn, x, d; fn = Object.getOwnPropertyDescriptor; x = o; while(x && !(d = fn(x, name))){x = x.__proto__;} return d; })"));
v8::Local<v8::Function> fn = fnSource->Run().As<v8::Function>();
- v8::Handle<v8::Value> rgArgs[] = {hChainObj, info[0]};
+ v8::Local<v8::Value> rgArgs[] = {hChainObj, info[0]};
v8::Local<v8::Value> hChainDescriptor = fn->Call(info.This(), 2, rgArgs);
if(!hChainDescriptor.IsEmpty() && hChainDescriptor->IsObject()) {
info.GetReturnValue().Set(hChainDescriptor);
@@ -270,7 +270,7 @@ void CFXJSE_Class::SetUpDynPropHandler(CFXJSE_Context* pContext, CFXJSE_Value* p hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "delete"), v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_delete, v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));
hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "defineProperty"), v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_defineProperty, v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));
hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "fix"), v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_fix, v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));
- v8::Handle<v8::Value> rgArgs[] = {hTrapper, hOldPrototype};
+ v8::Local<v8::Value> rgArgs[] = {hTrapper, hOldPrototype};
v8::Local<v8::Value> hNewPrototype = hHarmonyProxyCreateFn->Call(hHarmonyProxyObj, 2, rgArgs);
hObject->SetPrototype(hNewPrototype);
}
diff --git a/xfa/src/fxjse/src/runtime.h b/xfa/src/fxjse/src/runtime.h index 87d540ec9b..a51dc8f3eb 100644 --- a/xfa/src/fxjse/src/runtime.h +++ b/xfa/src/fxjse/src/runtime.h @@ -16,8 +16,8 @@ public: static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);
public:
v8::Isolate* m_pIsolate;
- v8::Persistent<v8::FunctionTemplate> m_hRootContextGlobalTemplate;
- v8::Persistent<v8::Context> m_hRootContext;
+ v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate;
+ v8::Global<v8::Context> m_hRootContext;
public:
static CFXJSE_RuntimeList* g_RuntimeList;
protected:
diff --git a/xfa/src/fxjse/src/util_inline.h b/xfa/src/fxjse/src/util_inline.h index dddcab3053..517b5545e8 100644 --- a/xfa/src/fxjse/src/util_inline.h +++ b/xfa/src/fxjse/src/util_inline.h @@ -24,7 +24,7 @@ static V8_INLINE FX_LPVOID FXJSE_RetrieveObjectBinding(const v8::Local<v8::Ob }
v8::Local<v8::Object> hObject = hJSObject;
if(hObject->InternalFieldCount() == 0) {
- v8::Handle<v8::Value> hProtoObject = hObject->GetPrototype();
+ v8::Local<v8::Value> hProtoObject = hObject->GetPrototype();
if(hProtoObject.IsEmpty() || !hProtoObject->IsObject()) {
return NULL;
}
diff --git a/xfa/src/fxjse/src/value.cpp b/xfa/src/fxjse/src/value.cpp index de7e05455b..21939e8747 100644 --- a/xfa/src/fxjse/src/value.cpp +++ b/xfa/src/fxjse/src/value.cpp @@ -254,8 +254,8 @@ void FXJSE_ThrowMessage(FX_BSTR utf8Name, FX_BSTR utf8Message) v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
ASSERT(pIsolate);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- v8::Handle<v8::String> hMessage = v8::String::NewFromUtf8(pIsolate, utf8Message.GetCStr(), v8::String::kNormalString, utf8Message.GetLength());
- v8::Handle<v8::Value> hError;
+ v8::Local<v8::String> hMessage = v8::String::NewFromUtf8(pIsolate, utf8Message.GetCStr(), v8::String::kNormalString, utf8Message.GetLength());
+ v8::Local<v8::Value> hError;
if(utf8Name == "RangeError") {
hError = v8::Exception::RangeError(hMessage);
} else if(utf8Name == "ReferenceError") {
@@ -433,7 +433,7 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(FX_BSTR szPropName, CFXJSE_Value* lpP FX_BOOL CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis)
{
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
- v8::Handle<v8::Value> rgArgs[2];
+ v8::Local<v8::Value> rgArgs[2];
v8::Local<v8::Value> hOldFunction = v8::Local<v8::Value>::New(m_pIsolate, lpOldFunction->DirectGetValue());
if(hOldFunction.IsEmpty() || !hOldFunction->IsFunction()) {
return FALSE;
@@ -467,14 +467,14 @@ FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver, CFXJSE_Value* lpRetValue, F return FALSE;
}
v8::Local<v8::Value> hReturnValue;
- v8::Handle<v8::Value>* lpLocalArgs = NULL;
+ v8::Local<v8::Value>* lpLocalArgs = NULL;
if(nArgCount) {
- lpLocalArgs = FX_Alloc(v8::Handle<v8::Value>, nArgCount);
+ lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);
if (!lpLocalArgs) {
return FALSE;
}
for (FX_UINT32 i = 0; i < nArgCount; i++) {
- new (lpLocalArgs + i) v8::Handle<v8::Value>;
+ new (lpLocalArgs + i) v8::Local<v8::Value>;
CFXJSE_Value* lpArg = (CFXJSE_Value*)lpArgs[i];
if(lpArg) {
lpLocalArgs[i] = v8::Local<v8::Value>::New(m_pIsolate, lpArg->DirectGetValue());
diff --git a/xfa/src/fxjse/src/value.h b/xfa/src/fxjse/src/value.h index eb118fd5c6..547ae9251f 100644 --- a/xfa/src/fxjse/src/value.h +++ b/xfa/src/fxjse/src/value.h @@ -209,7 +209,7 @@ public: {
return m_pIsolate;
}
- V8_INLINE const v8::Persistent<v8::Value>& DirectGetValue() const
+ V8_INLINE const v8::Global<v8::Value>& DirectGetValue() const
{
return m_hValue;
}
@@ -229,7 +229,7 @@ public: static CFXJSE_Value* Create(v8::Isolate* pIsolate);
protected:
v8::Isolate* m_pIsolate;
- v8::Persistent<v8::Value> m_hValue;
+ v8::Global<v8::Value> m_hValue;
friend class CFXJSE_Context;
friend class CFXJSE_Class;
};
|