Commit 52f0d911 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] Fix deprecated V8 function usage in zircon.cc

Fixes uses of deprecated Object::Set and FunctionTemplate::GetFunction
to use Context version that return Maybe values.

Bug: v8:7283, v8:7295, v8:8238, chromium:883496
Change-Id: Ia400ec8b36d138b9f6b87c4a91f7ccb12c2eeefa
Reviewed-on: https://chromium-review.googlesource.com/c/1352314
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611276}
parent 99312768
...@@ -361,31 +361,48 @@ ZxBindings::ZxBindings(v8::Isolate* isolate, v8::Local<v8::Object> global) ...@@ -361,31 +361,48 @@ ZxBindings::ZxBindings(v8::Isolate* isolate, v8::Local<v8::Object> global)
SET_CONSTANT(ZX_ERR_CONNECTION_RESET); SET_CONSTANT(ZX_ERR_CONNECTION_RESET);
SET_CONSTANT(ZX_ERR_CONNECTION_ABORTED); SET_CONSTANT(ZX_ERR_CONNECTION_ABORTED);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
// Handle APIs. // Handle APIs.
global->Set( global
gin::StringToSymbol(isolate, "$ZxObjectWaitOne"), ->Set(context, gin::StringToSymbol(isolate, "$ZxObjectWaitOne"),
gin::CreateFunctionTemplate(isolate, base::BindRepeating(ZxObjectWaitOne)) gin::CreateFunctionTemplate(isolate,
->GetFunction()); base::BindRepeating(ZxObjectWaitOne))
global->Set( ->GetFunction(context)
gin::StringToSymbol(isolate, "$zx_handle_close"), .ToLocalChecked())
gin::CreateFunctionTemplate(isolate, base::BindRepeating(zx_handle_close)) .ToChecked();
->GetFunction()); global
->Set(context, gin::StringToSymbol(isolate, "$zx_handle_close"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(zx_handle_close))
->GetFunction(context)
.ToLocalChecked())
.ToChecked();
SET_CONSTANT(ZX_HANDLE_INVALID); SET_CONSTANT(ZX_HANDLE_INVALID);
SET_CONSTANT(ZX_TIME_INFINITE); SET_CONSTANT(ZX_TIME_INFINITE);
// Channel APIs. // Channel APIs.
global->Set(gin::StringToSymbol(isolate, "$ZxChannelCreate"), global
->Set(context, gin::StringToSymbol(isolate, "$ZxChannelCreate"),
gin::CreateFunctionTemplate(isolate, gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&ZxChannelCreate)) base::BindRepeating(&ZxChannelCreate))
->GetFunction()); ->GetFunction(context)
global->Set( .ToLocalChecked())
gin::StringToSymbol(isolate, "$ZxChannelWrite"), .ToChecked();
gin::CreateFunctionTemplate(isolate, base::BindRepeating(&ZxChannelWrite)) global
->GetFunction()); ->Set(context, gin::StringToSymbol(isolate, "$ZxChannelWrite"),
global->Set( gin::CreateFunctionTemplate(isolate,
gin::StringToSymbol(isolate, "$ZxChannelRead"), base::BindRepeating(&ZxChannelWrite))
gin::CreateFunctionTemplate(isolate, base::BindRepeating(&ZxChannelRead)) ->GetFunction(context)
->GetFunction()); .ToLocalChecked())
.ToChecked();
global
->Set(context, gin::StringToSymbol(isolate, "$ZxChannelRead"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&ZxChannelRead))
->GetFunction(context)
.ToLocalChecked())
.ToChecked();
SET_CONSTANT(ZX_CHANNEL_READABLE); SET_CONSTANT(ZX_CHANNEL_READABLE);
SET_CONSTANT(ZX_CHANNEL_WRITABLE); SET_CONSTANT(ZX_CHANNEL_WRITABLE);
SET_CONSTANT(ZX_CHANNEL_PEER_CLOSED); SET_CONSTANT(ZX_CHANNEL_PEER_CLOSED);
...@@ -395,14 +412,20 @@ ZxBindings::ZxBindings(v8::Isolate* isolate, v8::Local<v8::Object> global) ...@@ -395,14 +412,20 @@ ZxBindings::ZxBindings(v8::Isolate* isolate, v8::Local<v8::Object> global)
// Utilities to make string handling easier to convert to/from UCS-2 (JS) <-> // Utilities to make string handling easier to convert to/from UCS-2 (JS) <->
// UTF-8 (FIDL). // UTF-8 (FIDL).
global->Set( global
gin::StringToSymbol(isolate, "$FidlJsStrToUtf8Array"), ->Set(context, gin::StringToSymbol(isolate, "$FidlJsStrToUtf8Array"),
gin::CreateFunctionTemplate(isolate, base::BindRepeating(&StrToUtf8Array)) gin::CreateFunctionTemplate(isolate,
->GetFunction()); base::BindRepeating(&StrToUtf8Array))
global->Set( ->GetFunction(context)
gin::StringToSymbol(isolate, "$FidlJsUtf8ArrayToStr"), .ToLocalChecked())
gin::CreateFunctionTemplate(isolate, base::BindRepeating(&Utf8ArrayToStr)) .ToChecked();
->GetFunction()); global
->Set(context, gin::StringToSymbol(isolate, "$FidlJsUtf8ArrayToStr"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&Utf8ArrayToStr))
->GetFunction(context)
.ToLocalChecked())
.ToChecked();
#undef SET_CONSTANT #undef SET_CONSTANT
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment