From 6c3665776eb6276be2b2314cd4242e7c21610ea2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 6 Nov 2017 21:36:01 +0000 Subject: Cleanup CFXJSE_Value::SetObject All of the callers to SetObject pass in the class so we can remove the class check. The SetJSObject method is no longer needed. The SetHostObject method has been merged into the SetObject method. Change-Id: Id80931b88cc0656d021350ea8d62369513b86b9d Reviewed-on: https://pdfium-review.googlesource.com/17858 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fxjs/cfxjse_value.cpp | 18 +----------------- fxjs/cfxjse_value.h | 2 -- 2 files changed, 1 insertion(+), 19 deletions(-) (limited to 'fxjs') diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp index 93e568c0ba..0a135951d9 100644 --- a/fxjs/cfxjse_value.cpp +++ b/fxjs/cfxjse_value.cpp @@ -83,20 +83,9 @@ CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const { void CFXJSE_Value::SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass) { - if (!pClass) { - ASSERT(!lpObject); - SetJSObject(); - return; - } - SetHostObject(lpObject, pClass); -} - -void CFXJSE_Value::SetHostObject(CFXJSE_HostObject* lpObject, - CFXJSE_Class* lpClass) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); - ASSERT(lpClass); v8::Local hClass = - v8::Local::New(m_pIsolate, lpClass->m_hTemplate); + v8::Local::New(m_pIsolate, pClass->m_hTemplate); v8::Local hObject = hClass->InstanceTemplate()->NewInstance(); FXJSE_UpdateObjectBinding(hObject, lpObject); m_hValue.Reset(m_pIsolate, hObject); @@ -510,8 +499,3 @@ void CFXJSE_Value::SetString(const ByteStringView& szString) { m_hValue.Reset(m_pIsolate, hValue); } -void CFXJSE_Value::SetJSObject() { - CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); - v8::Local hValue = v8::Object::New(m_pIsolate); - m_hValue.Reset(m_pIsolate, hValue); -} diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h index f506857965..52905db90f 100644 --- a/fxjs/cfxjse_value.h +++ b/fxjs/cfxjse_value.h @@ -51,10 +51,8 @@ class CFXJSE_Value { void SetDouble(double dDouble); void SetString(const ByteStringView& szString); void SetFloat(float fFloat); - void SetJSObject(); void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); - void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass); void SetArray(const std::vector>& values); void SetDate(double dDouble); -- cgit v1.2.3