diff options
author | Lei Zhang <thestig@chromium.org> | 2018-08-28 23:12:22 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-28 23:12:22 +0000 |
commit | da379c7af512aa7baa221d38b04c8aa9912b4e02 (patch) | |
tree | 2d98da7f03c36051aa96a372126020fc3eb94c12 /fxjs/cfxjse_class.cpp | |
parent | cf59f804ea8bc83fe0d70148de15a3b5cedc801f (diff) | |
download | pdfium-da379c7af512aa7baa221d38b04c8aa9912b4e02.tar.xz |
Stop using deprecated v8::ObjectTemplate::NewInstance().
Fix nits in affected files.
Change-Id: I3a0363c9b7c28359fd1c7cea305e4f7705a228c2
Reviewed-on: https://pdfium-review.googlesource.com/41355
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_class.cpp')
-rw-r--r-- | fxjs/cfxjse_class.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index 0d68147326..8e49ebe373 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -142,7 +142,9 @@ void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, v8::ObjectTemplate::New(pIsolate); hCallBackInfoTemplate->SetInternalFieldCount(2); v8::Local<v8::Object> hCallBackInfo = - hCallBackInfoTemplate->NewInstance(); + hCallBackInfoTemplate + ->NewInstance(pValue->GetIsolate()->GetCurrentContext()) + .ToLocalChecked(); hCallBackInfo->SetAlignedPointerInInternalField( 0, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClass)); hCallBackInfo->SetInternalField( @@ -251,6 +253,21 @@ void NamedPropertyEnumeratorCallback( info.GetReturnValue().Set(v8::Array::New(info.GetIsolate())); } +void SetUpNamedPropHandler(v8::Isolate* pIsolate, + v8::Local<v8::ObjectTemplate>* pObjectTemplate, + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition) { + v8::NamedPropertyHandlerConfiguration configuration( + lpClassDefinition->dynPropGetter ? NamedPropertyGetterCallback : nullptr, + lpClassDefinition->dynPropSetter ? NamedPropertySetterCallback : nullptr, + lpClassDefinition->dynPropTypeGetter ? NamedPropertyQueryCallback + : nullptr, + nullptr, NamedPropertyEnumeratorCallback, + v8::External::New(pIsolate, + const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), + v8::PropertyHandlerFlags::kNonMasking); + (*pObjectTemplate)->SetHandler(configuration); +} + } // namespace // static @@ -280,7 +297,7 @@ CFXJSE_Class* CFXJSE_Class::Create( hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(2); v8::Local<v8::ObjectTemplate> hObjectTemplate = hFunctionTemplate->InstanceTemplate(); - SetUpNamedPropHandler(pIsolate, hObjectTemplate, lpClassDefinition); + SetUpNamedPropHandler(pIsolate, &hObjectTemplate, lpClassDefinition); if (lpClassDefinition->methNum) { for (int32_t i = 0; i < lpClassDefinition->methNum; i++) { @@ -310,23 +327,6 @@ CFXJSE_Class* CFXJSE_Class::Create( return pResult; } -// static -void CFXJSE_Class::SetUpNamedPropHandler( - v8::Isolate* pIsolate, - v8::Local<v8::ObjectTemplate>& hObjectTemplate, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition) { - v8::NamedPropertyHandlerConfiguration configuration( - lpClassDefinition->dynPropGetter ? NamedPropertyGetterCallback : 0, - lpClassDefinition->dynPropSetter ? NamedPropertySetterCallback : 0, - lpClassDefinition->dynPropTypeGetter ? NamedPropertyQueryCallback : 0, 0, - NamedPropertyEnumeratorCallback, - v8::External::New(pIsolate, - const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), - v8::PropertyHandlerFlags::kNonMasking); - hObjectTemplate->SetHandler(configuration); -} - -CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) - : m_lpClassDefinition(nullptr), m_pContext(lpContext) {} +CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) : m_pContext(lpContext) {} CFXJSE_Class::~CFXJSE_Class() {} |