Change CFXJSE_Context::GetGlobalObject to return
This Cl changes CFXJSE_Context::GetGlobalObject to return a
std::unique_ptr<CFXJSE_Value> instead of accepting a CFXJSE_Value out parameter.
All usages created the CFXJSE_Value with the same runtime as the caller.
Review-Url: https://codereview.chromium.org/2056733003
diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp
index 8eacc77..e5d5f99 100644
--- a/xfa/fxjse/context.cpp
+++ b/xfa/fxjse/context.cpp
@@ -157,13 +157,16 @@
CFXJSE_Context::~CFXJSE_Context() {}
-void CFXJSE_Context::GetGlobalObject(CFXJSE_Value* pValue) {
- ASSERT(pValue);
+std::unique_ptr<CFXJSE_Value> CFXJSE_Context::GetGlobalObject() {
+ std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(m_pIsolate));
+
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
v8::Local<v8::Context> hContext =
v8::Local<v8::Context>::New(m_pIsolate, m_hContext);
v8::Local<v8::Object> hGlobalObject = hContext->Global();
pValue->ForceSetValue(hGlobalObject);
+
+ return pValue;
}
void CFXJSE_Context::EnableCompatibleMode() {