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

Side by Side Diff: content/renderer/java/gin_java_function_invocation_helper.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_function_invocation_helper.h" 5 #include "content/renderer/java/gin_java_function_invocation_helper.h"
6 6
7 #include "content/common/android/gin_java_bridge_errors.h" 7 #include "content/common/android/gin_java_bridge_errors.h"
8 #include "content/common/android/gin_java_bridge_value.h" 8 #include "content/common/android/gin_java_bridge_value.h"
9 #include "content/public/child/v8_value_converter.h" 9 #include "content/public/child/v8_value_converter.h"
10 #include "content/renderer/java/gin_java_bridge_object.h" 10 #include "content/renderer/java/gin_java_bridge_object.h"
(...skipping 16 matching lines...) Expand all
27 const std::string& method_name, 27 const std::string& method_name,
28 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher) 28 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher)
29 : method_name_(method_name), 29 : method_name_(method_name),
30 dispatcher_(dispatcher), 30 dispatcher_(dispatcher),
31 converter_(new GinJavaBridgeValueConverter()) { 31 converter_(new GinJavaBridgeValueConverter()) {
32 } 32 }
33 33
34 GinJavaFunctionInvocationHelper::~GinJavaFunctionInvocationHelper() { 34 GinJavaFunctionInvocationHelper::~GinJavaFunctionInvocationHelper() {
35 } 35 }
36 36
37 v8::Handle<v8::Value> GinJavaFunctionInvocationHelper::Invoke( 37 v8::Local<v8::Value> GinJavaFunctionInvocationHelper::Invoke(
38 gin::Arguments* args) { 38 gin::Arguments* args) {
39 if (!dispatcher_) { 39 if (!dispatcher_) {
40 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8( 40 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
41 args->isolate(), kMethodInvocationErrorMessage))); 41 args->isolate(), kMethodInvocationErrorMessage)));
42 return v8::Undefined(args->isolate()); 42 return v8::Undefined(args->isolate());
43 } 43 }
44 44
45 if (args->IsConstructCall()) { 45 if (args->IsConstructCall()) {
46 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8( 46 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
47 args->isolate(), kMethodInvocationAsConstructorDisallowed))); 47 args->isolate(), kMethodInvocationAsConstructorDisallowed)));
48 return v8::Undefined(args->isolate()); 48 return v8::Undefined(args->isolate());
49 } 49 }
50 50
51 content::GinJavaBridgeObject* object = NULL; 51 content::GinJavaBridgeObject* object = NULL;
52 if (!args->GetHolder(&object) || !object) { 52 if (!args->GetHolder(&object) || !object) {
53 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8( 53 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
54 args->isolate(), kMethodInvocationOnNonInjectedObjectDisallowed))); 54 args->isolate(), kMethodInvocationOnNonInjectedObjectDisallowed)));
55 return v8::Undefined(args->isolate()); 55 return v8::Undefined(args->isolate());
56 } 56 }
57 57
58 base::ListValue arguments; 58 base::ListValue arguments;
59 { 59 {
60 v8::HandleScope handle_scope(args->isolate()); 60 v8::HandleScope handle_scope(args->isolate());
61 v8::Handle<v8::Context> context = args->isolate()->GetCurrentContext(); 61 v8::Local<v8::Context> context = args->isolate()->GetCurrentContext();
62 v8::Handle<v8::Value> val; 62 v8::Local<v8::Value> val;
63 while (args->GetNext(&val)) { 63 while (args->GetNext(&val)) {
64 scoped_ptr<base::Value> arg(converter_->FromV8Value(val, context)); 64 scoped_ptr<base::Value> arg(converter_->FromV8Value(val, context));
65 if (arg.get()) { 65 if (arg.get()) {
66 arguments.Append(arg.release()); 66 arguments.Append(arg.release());
67 } else { 67 } else {
68 arguments.Append(base::Value::CreateNullValue()); 68 arguments.Append(base::Value::CreateNullValue());
69 } 69 }
70 } 70 }
71 } 71 }
72 72
(...skipping 27 matching lines...) Expand all
100 } 100 }
101 } else if (gin_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)) { 101 } else if (gin_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)) {
102 float float_value; 102 float float_value;
103 gin_value->GetAsNonFinite(&float_value); 103 gin_value->GetAsNonFinite(&float_value);
104 return v8::Number::New(args->isolate(), float_value); 104 return v8::Number::New(args->isolate(), float_value);
105 } 105 }
106 return v8::Undefined(args->isolate()); 106 return v8::Undefined(args->isolate());
107 } 107 }
108 108
109 } // namespace content 109 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/gin_java_function_invocation_helper.h ('k') | content/renderer/memory_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698