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

Side by Side Diff: android_webview/renderer/aw_message_port_client.cc

Issue 2014323002: Use std::unique_ptr<base::Value> in V8ValueConverter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android fixes Created 4 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
« no previous file with comments | « no previous file | chrome/renderer/extensions/cast_streaming_native_handler.cc » ('j') | 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 "android_webview/renderer/aw_message_port_client.h" 5 #include "android_webview/renderer/aw_message_port_client.h"
6 6
7 #include <memory>
8 #include <utility>
9
7 #include "android_webview/common/aw_message_port_messages.h" 10 #include "android_webview/common/aw_message_port_messages.h"
8 #include "content/public/child/v8_value_converter.h" 11 #include "content/public/child/v8_value_converter.h"
9 #include "content/public/renderer/render_frame.h" 12 #include "content/public/renderer/render_frame.h"
10 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
11 #include "ipc/ipc_message_macros.h" 14 #include "ipc/ipc_message_macros.h"
12 #include "third_party/WebKit/public/web/WebFrame.h" 15 #include "third_party/WebKit/public/web/WebFrame.h"
13 #include "third_party/WebKit/public/web/WebKit.h" 16 #include "third_party/WebKit/public/web/WebKit.h"
14 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" 17 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
15 #include "third_party/WebKit/public/web/WebView.h" 18 #include "third_party/WebKit/public/web/WebView.h"
16 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 v8::Context::Scope context_scope(context); 58 v8::Context::Scope context_scope(context);
56 DCHECK(!context.IsEmpty()); 59 DCHECK(!context.IsEmpty());
57 WebSerializedScriptValue v = WebSerializedScriptValue::fromString(message); 60 WebSerializedScriptValue v = WebSerializedScriptValue::fromString(message);
58 v8::Local<v8::Value> v8value = v.deserialize(); 61 v8::Local<v8::Value> v8value = v.deserialize();
59 62
60 std::unique_ptr<V8ValueConverter> converter; 63 std::unique_ptr<V8ValueConverter> converter;
61 converter.reset(V8ValueConverter::create()); 64 converter.reset(V8ValueConverter::create());
62 converter->SetDateAllowed(true); 65 converter->SetDateAllowed(true);
63 converter->SetRegExpAllowed(true); 66 converter->SetRegExpAllowed(true);
64 base::ListValue result; 67 base::ListValue result;
65 base::Value* value = converter->FromV8Value(v8value, context); 68 std::unique_ptr<base::Value> value = converter->FromV8Value(v8value, context);
66 if (value) { 69 if (value) {
67 result.Append(value); 70 result.Append(std::move(value));
68 } 71 }
69 72
70 Send(new AwMessagePortHostMsg_ConvertedWebToAppMessage( 73 Send(new AwMessagePortHostMsg_ConvertedWebToAppMessage(
71 render_frame()->GetRoutingID(), message_port_id, result, 74 render_frame()->GetRoutingID(), message_port_id, result,
72 sent_message_port_ids)); 75 sent_message_port_ids));
73 } 76 }
74 77
75 void AwMessagePortClient::OnAppToWebMessage( 78 void AwMessagePortClient::OnAppToWebMessage(
76 int message_port_id, 79 int message_port_id,
77 const base::string16& message, 80 const base::string16& message,
(...skipping 21 matching lines...) Expand all
99 render_frame()->GetRoutingID(), message_port_id, 102 render_frame()->GetRoutingID(), message_port_id,
100 result, sent_message_port_ids)); 103 result, sent_message_port_ids));
101 } 104 }
102 105
103 void AwMessagePortClient::OnClosePort(int message_port_id) { 106 void AwMessagePortClient::OnClosePort(int message_port_id) {
104 Send(new AwMessagePortHostMsg_ClosePortAck(render_frame()->GetRoutingID(), 107 Send(new AwMessagePortHostMsg_ClosePortAck(render_frame()->GetRoutingID(),
105 message_port_id)); 108 message_port_id));
106 } 109 }
107 110
108 } 111 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/cast_streaming_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698