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

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

Issue 2811253004: Remove ListValue::Append(raw ptr) on Android (Closed)
Patch Set: Comments Created 3 years, 8 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
« no previous file with comments | « content/renderer/java/gin_java_bridge_value_converter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility>
8
7 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h"
8 #include "content/common/android/gin_java_bridge_errors.h" 11 #include "content/common/android/gin_java_bridge_errors.h"
9 #include "content/common/android/gin_java_bridge_value.h" 12 #include "content/common/android/gin_java_bridge_value.h"
10 #include "content/public/child/v8_value_converter.h" 13 #include "content/public/child/v8_value_converter.h"
11 #include "content/renderer/java/gin_java_bridge_object.h" 14 #include "content/renderer/java/gin_java_bridge_object.h"
12 #include "content/renderer/java/gin_java_bridge_value_converter.h" 15 #include "content/renderer/java/gin_java_bridge_value_converter.h"
13 16
14 namespace content { 17 namespace content {
15 18
16 namespace { 19 namespace {
17 20
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return v8::Undefined(args->isolate()); 59 return v8::Undefined(args->isolate());
57 } 60 }
58 61
59 base::ListValue arguments; 62 base::ListValue arguments;
60 { 63 {
61 v8::HandleScope handle_scope(args->isolate()); 64 v8::HandleScope handle_scope(args->isolate());
62 v8::Local<v8::Context> context = args->isolate()->GetCurrentContext(); 65 v8::Local<v8::Context> context = args->isolate()->GetCurrentContext();
63 v8::Local<v8::Value> val; 66 v8::Local<v8::Value> val;
64 while (args->GetNext(&val)) { 67 while (args->GetNext(&val)) {
65 std::unique_ptr<base::Value> arg(converter_->FromV8Value(val, context)); 68 std::unique_ptr<base::Value> arg(converter_->FromV8Value(val, context));
66 if (arg.get()) { 69 if (arg.get())
67 arguments.Append(arg.release()); 70 arguments.Append(std::move(arg));
68 } else { 71 else
69 arguments.Append(base::MakeUnique<base::Value>()); 72 arguments.Append(base::MakeUnique<base::Value>());
70 }
71 } 73 }
72 } 74 }
73 75
74 GinJavaBridgeError error; 76 GinJavaBridgeError error;
75 std::unique_ptr<base::Value> result = dispatcher_->InvokeJavaMethod( 77 std::unique_ptr<base::Value> result = dispatcher_->InvokeJavaMethod(
76 object->object_id(), method_name_, arguments, &error); 78 object->object_id(), method_name_, arguments, &error);
77 if (!result.get()) { 79 if (!result.get()) {
78 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8( 80 args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
79 args->isolate(), GinJavaBridgeErrorToString(error)))); 81 args->isolate(), GinJavaBridgeErrorToString(error))));
80 return v8::Undefined(args->isolate()); 82 return v8::Undefined(args->isolate());
(...skipping 20 matching lines...) Expand all
101 } 103 }
102 } else if (gin_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)) { 104 } else if (gin_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)) {
103 float float_value; 105 float float_value;
104 gin_value->GetAsNonFinite(&float_value); 106 gin_value->GetAsNonFinite(&float_value);
105 return v8::Number::New(args->isolate(), float_value); 107 return v8::Number::New(args->isolate(), float_value);
106 } 108 }
107 return v8::Undefined(args->isolate()); 109 return v8::Undefined(args->isolate());
108 } 110 }
109 111
110 } // namespace content 112 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/gin_java_bridge_value_converter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698