[cleanup] Replace deprecated v8 Write/Length methods
since they infer the Isolate from the address of the String they're
called on. This will cease to work reliably in future V8 releases, so
this change replaces all uses in chromium with ones that pass in the
Isolate explicitly.
v8: :Write, v8::WriteUtf8 and v8::Utf8Length are marked V8_DEPRECATE_SOON
Change-Id: I13780586c91de98375adec0ad414d65476ed5170
Reviewed-on: https://chromium-review.googlesource.com/1149879
Reviewed-by: Peter Beverloo <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Rachel Blum <[email protected]>
Commit-Queue: Dan Elphick <[email protected]>
Cr-Commit-Position: refs/heads/master@{#578579}
diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc
index c72b74ae..a36cfabf 100644
--- a/components/translate/content/renderer/translate_helper.cc
+++ b/components/translate/content/renderer/translate_helper.cc
@@ -222,7 +222,8 @@
if (!main_frame)
return std::string();
- v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope handle_scope(isolate);
WebScriptSource source = WebScriptSource(WebString::FromASCII(script));
v8::Local<v8::Value> result =
main_frame->ExecuteScriptInIsolatedWorldAndReturnValue(world_id_, source);
@@ -232,9 +233,9 @@
}
v8::Local<v8::String> v8_str = result.As<v8::String>();
- int length = v8_str->Utf8Length() + 1;
+ int length = v8_str->Utf8Length(isolate) + 1;
std::unique_ptr<char[]> str(new char[length]);
- v8_str->WriteUtf8(str.get(), length);
+ v8_str->WriteUtf8(isolate, str.get(), length);
return std::string(str.get());
}