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

Unified Diff: android_webview/browser/aw_message_port_message_filter.cc

Issue 921013002: Optionally have MessagePort pass data as base::Value, part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-move-v8-value-converter
Patch Set: Update singly-included comment 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
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 fc2d314496c1c7d716376d85f5f9cccca3657a79..b19b344651421d93db02ca35035e7ec5a3532d64 100644
--- a/android_webview/browser/aw_message_port_message_filter.cc
+++ b/android_webview/browser/aw_message_port_message_filter.cc
@@ -7,6 +7,7 @@
#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/common/aw_message_port_messages.h"
#include "content/public/browser/message_port_provider.h"
+#include "content/public/common/message_port_types.h"
using content::BrowserThread;
using content::MessagePortProvider;
@@ -46,7 +47,10 @@ void AwMessagePortMessageFilter::OnConvertedAppToWebMessage(
const base::string16& message,
const std::vector<int>& sent_message_port_ids) {
- MessagePortProvider::PostMessageToPort(msg_port_id, message,
+ // 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);
}
@@ -76,12 +80,13 @@ void AwMessagePortMessageFilter::SendClosePortMessage(int message_port_id) {
void AwMessagePortMessageFilter::SendMessage(
int msg_port_route_id,
- const base::string16& message,
+ const content::MessagePortMessage& message,
const std::vector<int>& sent_message_port_ids) {
+ DCHECK(message.is_string());
Send(new AwMessagePortMsg_WebToAppMessage(
route_id_,
msg_port_route_id, // same as the port id
- message, sent_message_port_ids));
+ message.message_as_string, sent_message_port_ids));
}
void AwMessagePortMessageFilter::SendMessagesAreQueued(int route_id) {
« no previous file with comments | « android_webview/browser/aw_message_port_message_filter.h ('k') | content/browser/message_port_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698