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

Unified Diff: webkit/plugins/ppapi/message_channel.cc

Issue 11264049: PPAPI: Make Messaging not PostTask and copy when out-of-process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « no previous file | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/message_channel.cc
diff --git a/webkit/plugins/ppapi/message_channel.cc b/webkit/plugins/ppapi/message_channel.cc
index 646b822201ca6e640262c3cd96ee892d2f8a82c3..44e6467a9f6eea8a9ccbfcf374359903f448c85b 100644
--- a/webkit/plugins/ppapi/message_channel.cc
+++ b/webkit/plugins/ppapi/message_channel.cc
@@ -24,6 +24,7 @@
#include "v8/include/v8.h"
#include "webkit/plugins/ppapi/host_array_buffer_var.h"
#include "webkit/plugins/ppapi/npapi_glue.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
using ppapi::ArrayBufferVar;
@@ -358,11 +359,17 @@ void MessageChannel::PostMessageToJavaScript(PP_Var message_data) {
WebSerializedScriptValue serialized_val =
WebSerializedScriptValue::serialize(v8_val);
- MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&MessageChannel::PostMessageToJavaScriptImpl,
- weak_ptr_factory_.GetWeakPtr(),
- serialized_val));
+ if (instance_->module()->IsProxied()) {
+ // The proxy sent an asynchronous message, so the plugin is already
+ // unblocked. Therefore, there's no need to PostTask.
+ PostMessageToJavaScriptImpl(serialized_val);
+ } else {
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&MessageChannel::PostMessageToJavaScriptImpl,
+ weak_ptr_factory_.GetWeakPtr(),
+ serialized_val));
+ }
}
void MessageChannel::PostMessageToJavaScriptImpl(
@@ -398,13 +405,20 @@ void MessageChannel::PostMessageToJavaScriptImpl(
}
void MessageChannel::PostMessageToNative(PP_Var message_data) {
- // Make a copy of the message data for the Task we will run.
- PP_Var var_copy(CopyPPVar(message_data));
+ if (instance_->module()->IsProxied()) {
+ // In the proxied case, the copy will happen via serialization, and the
+ // message is asynchronous. Therefore there's no need to copy the Var, nor
+ // to PostTask.
+ PostMessageToNativeImpl(message_data);
+ } else {
+ // Make a copy of the message data for the Task we will run.
+ PP_Var var_copy(CopyPPVar(message_data));
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&MessageChannel::PostMessageToNativeImpl,
- weak_ptr_factory_.GetWeakPtr(),
- var_copy));
+ MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(&MessageChannel::PostMessageToNativeImpl,
+ weak_ptr_factory_.GetWeakPtr(),
+ var_copy));
+ }
}
void MessageChannel::PostMessageToNativeImpl(PP_Var message_data) {
« no previous file with comments | « no previous file | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698