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

Unified Diff: android_webview/browser/aw_message_port_message_filter.cc

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/aw_message_port_message_filter.h ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_message_port_message_filter.cc
diff --git a/android_webview/browser/aw_message_port_message_filter.cc b/android_webview/browser/aw_message_port_message_filter.cc
index b19b344651421d93db02ca35035e7ec5a3532d64..8c434b52cbf5305b6441cd441a8c62adc547f127 100644
--- a/android_webview/browser/aw_message_port_message_filter.cc
+++ b/android_webview/browser/aw_message_port_message_filter.cc
@@ -46,12 +46,15 @@ void AwMessagePortMessageFilter::OnConvertedAppToWebMessage(
int msg_port_id,
const base::string16& message,
const std::vector<int>& sent_message_port_ids) {
-
+ std::vector<content::TransferredMessagePort>
+ sent_ports(sent_message_port_ids.size());
+ for (size_t i = 0; i < sent_message_port_ids.size(); ++i)
+ sent_ports[i].id = sent_message_port_ids[i];
// TODO(mek): Bypass the extra roundtrip and just send the unconverted message
// to the renderer directly.
MessagePortProvider::PostMessageToPort(msg_port_id,
content::MessagePortMessage(message),
- sent_message_port_ids);
+ sent_ports);
}
void AwMessagePortMessageFilter::OnClosePortAck(int message_port_id) {
@@ -81,8 +84,13 @@ void AwMessagePortMessageFilter::SendClosePortMessage(int message_port_id) {
void AwMessagePortMessageFilter::SendMessage(
int msg_port_route_id,
const content::MessagePortMessage& message,
- const std::vector<int>& sent_message_port_ids) {
+ const std::vector<content::TransferredMessagePort>& sent_message_ports) {
DCHECK(message.is_string());
+ std::vector<int> sent_message_port_ids(sent_message_ports.size());
+ for (size_t i = 0; i < sent_message_ports.size(); ++i) {
+ DCHECK(!sent_message_ports[i].send_messages_as_values);
+ sent_message_port_ids[i] = sent_message_ports[i].id;
+ }
Send(new AwMessagePortMsg_WebToAppMessage(
route_id_,
msg_port_route_id, // same as the port id
« no previous file with comments | « android_webview/browser/aw_message_port_message_filter.h ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698