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

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: Add includes 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
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"
jdoerrie 2017/04/12 16:08:55 #include "base/values.h"
vabr (Chromium) 2017/04/12 16:40:53 Done.
8 #include "content/common/android/gin_java_bridge_errors.h" 10 #include "content/common/android/gin_java_bridge_errors.h"
9 #include "content/common/android/gin_java_bridge_value.h" 11 #include "content/common/android/gin_java_bridge_value.h"
10 #include "content/public/child/v8_value_converter.h" 12 #include "content/public/child/v8_value_converter.h"
11 #include "content/renderer/java/gin_java_bridge_object.h" 13 #include "content/renderer/java/gin_java_bridge_object.h"
12 #include "content/renderer/java/gin_java_bridge_value_converter.h" 14 #include "content/renderer/java/gin_java_bridge_value_converter.h"
13 15
14 namespace content { 16 namespace content {
15 17
16 namespace { 18 namespace {
17 19
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 59 }
58 60
59 base::ListValue arguments; 61 base::ListValue arguments;
60 { 62 {
61 v8::HandleScope handle_scope(args->isolate()); 63 v8::HandleScope handle_scope(args->isolate());
62 v8::Local<v8::Context> context = args->isolate()->GetCurrentContext(); 64 v8::Local<v8::Context> context = args->isolate()->GetCurrentContext();
63 v8::Local<v8::Value> val; 65 v8::Local<v8::Value> val;
64 while (args->GetNext(&val)) { 66 while (args->GetNext(&val)) {
65 std::unique_ptr<base::Value> arg(converter_->FromV8Value(val, context)); 67 std::unique_ptr<base::Value> arg(converter_->FromV8Value(val, context));
66 if (arg.get()) { 68 if (arg.get()) {
67 arguments.Append(arg.release()); 69 arguments.Append(std::move(arg));
jdoerrie 2017/04/12 16:08:55 Consider removing braces around if and else.
vabr (Chromium) 2017/04/12 16:40:53 Admittedly, this file is itself not consistent in
jdoerrie 2017/04/12 18:30:19 Alright, sounds good :) I am not feeling too stron
68 } else { 70 } else {
69 arguments.Append(base::MakeUnique<base::Value>()); 71 arguments.Append(base::MakeUnique<base::Value>());
70 } 72 }
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()) {
(...skipping 23 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

Powered by Google App Engine
This is Rietveld 408576698