gin: Fix use of V8_DEPRECATE_SOON methods

String::Utf8Length and StackTrace::GetFrame should now be called with
an Isolate, which means gin::V8ToString now needs an Isolate hence the
cascade of changes.

Change-Id: I03f3bb91a2e985626bfa62dc1b4cd0874d00630d
Reviewed-on: https://chromium-review.googlesource.com/1146651
Reviewed-by: Peter Beverloo <[email protected]>
Reviewed-by: Ross McIlroy <[email protected]>
Reviewed-by: Devlin <[email protected]>
Commit-Queue: Dan Elphick <[email protected]>
Cr-Commit-Position: refs/heads/master@{#577295}
diff --git a/extensions/renderer/runtime_hooks_delegate.cc b/extensions/renderer/runtime_hooks_delegate.cc
index 49e95df..cb1dbb5 100644
--- a/extensions/renderer/runtime_hooks_delegate.cc
+++ b/extensions/renderer/runtime_hooks_delegate.cc
@@ -178,13 +178,14 @@
   DCHECK(arguments[0]->IsString());
   DCHECK(script_context->extension());
 
-  std::string path = gin::V8ToString(arguments[0]);
+  v8::Isolate* isolate = script_context->isolate();
+  std::string path = gin::V8ToString(isolate, arguments[0]);
 
   RequestResult result(RequestResult::HANDLED);
   std::string url = base::StringPrintf(
       "chrome-extension://%s%s%s", script_context->extension()->id().c_str(),
       !path.empty() && path[0] == '/' ? "" : "/", path.c_str());
-  result.return_value = gin::StringToV8(script_context->isolate(), url);
+  result.return_value = gin::StringToV8(isolate, url);
 
   return result;
 }
@@ -238,7 +239,8 @@
     const std::vector<v8::Local<v8::Value>>& arguments) {
   DCHECK_EQ(3u, arguments.size());
 
-  std::string application_name = gin::V8ToString(arguments[0]);
+  std::string application_name =
+      gin::V8ToString(script_context->isolate(), arguments[0]);
 
   v8::Local<v8::Value> v8_message = arguments[1];
   DCHECK(!v8_message.IsEmpty());
@@ -301,7 +303,8 @@
   DCHECK_EQ(1u, arguments.size());
   DCHECK(arguments[0]->IsString());
 
-  std::string application_name = gin::V8ToString(arguments[0]);
+  std::string application_name =
+      gin::V8ToString(script_context->isolate(), arguments[0]);
   gin::Handle<GinPort> port = messaging_service_->Connect(
       script_context, MessageTarget::ForNativeApp(application_name),
       std::string(), false);