Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: content/renderer/java/gin_java_bridge_object.cc

Issue 1113783002: Use Local instead of Handle in src/content/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/java/gin_java_bridge_object.h" 5 #include "content/renderer/java/gin_java_bridge_object.h"
6 6
7 #include "content/renderer/java/gin_java_function_invocation_helper.h" 7 #include "content/renderer/java/gin_java_function_invocation_helper.h"
8 #include "gin/function_template.h" 8 #include "gin/function_template.h"
9 #include "third_party/WebKit/public/web/WebFrame.h" 9 #include "third_party/WebKit/public/web/WebFrame.h"
10 #include "third_party/WebKit/public/web/WebKit.h" 10 #include "third_party/WebKit/public/web/WebKit.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 // static 14 // static
15 GinJavaBridgeObject* GinJavaBridgeObject::InjectNamed( 15 GinJavaBridgeObject* GinJavaBridgeObject::InjectNamed(
16 blink::WebFrame* frame, 16 blink::WebFrame* frame,
17 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, 17 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher,
18 const std::string& object_name, 18 const std::string& object_name,
19 GinJavaBridgeDispatcher::ObjectID object_id) { 19 GinJavaBridgeDispatcher::ObjectID object_id) {
20 v8::Isolate* isolate = blink::mainThreadIsolate(); 20 v8::Isolate* isolate = blink::mainThreadIsolate();
21 v8::HandleScope handle_scope(isolate); 21 v8::HandleScope handle_scope(isolate);
22 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 22 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
23 if (context.IsEmpty()) 23 if (context.IsEmpty())
24 return NULL; 24 return NULL;
25 25
26 GinJavaBridgeObject* object = 26 GinJavaBridgeObject* object =
27 new GinJavaBridgeObject(isolate, dispatcher, object_id); 27 new GinJavaBridgeObject(isolate, dispatcher, object_id);
28 28
29 v8::Context::Scope context_scope(context); 29 v8::Context::Scope context_scope(context);
30 v8::Handle<v8::Object> global = context->Global(); 30 v8::Local<v8::Object> global = context->Global();
31 gin::Handle<GinJavaBridgeObject> controller = 31 gin::Handle<GinJavaBridgeObject> controller =
32 gin::CreateHandle(isolate, object); 32 gin::CreateHandle(isolate, object);
33 // WrappableBase instance deletes itself in case of a wrapper 33 // WrappableBase instance deletes itself in case of a wrapper
34 // creation failure, thus there is no need to delete |object|. 34 // creation failure, thus there is no need to delete |object|.
35 if (controller.IsEmpty()) 35 if (controller.IsEmpty())
36 return NULL; 36 return NULL;
37 37
38 global->Set(gin::StringToV8(isolate, object_name), controller.ToV8()); 38 global->Set(gin::StringToV8(isolate, object_name), controller.ToV8());
39 return object; 39 return object;
40 } 40 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 isolate, base::Bind(&GinJavaFunctionInvocationHelper::Invoke, 103 isolate, base::Bind(&GinJavaFunctionInvocationHelper::Invoke,
104 base::Owned(new GinJavaFunctionInvocationHelper( 104 base::Owned(new GinJavaFunctionInvocationHelper(
105 name, dispatcher_)))); 105 name, dispatcher_))));
106 template_cache_.Set(name, function_template); 106 template_cache_.Set(name, function_template);
107 return function_template; 107 return function_template;
108 } 108 }
109 109
110 gin::WrapperInfo GinJavaBridgeObject::kWrapperInfo = {gin::kEmbedderNativeGin}; 110 gin::WrapperInfo GinJavaBridgeObject::kWrapperInfo = {gin::kEmbedderNativeGin};
111 111
112 } // namespace content 112 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | content/renderer/java/gin_java_bridge_value_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698