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

Unified Diff: ppapi/proxy/plugin_resource.cc

Issue 11106019: PluginResource: Avoid having two sets of similar methods for talking with browser and renderer. (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 | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/printing_resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_resource.cc
diff --git a/ppapi/proxy/plugin_resource.cc b/ppapi/proxy/plugin_resource.cc
index 99ade839fc91a05d7018643230ca57aeafc04f0d..c568df5c39ca8c502faeba4cbc4d52d53f4fa541 100644
--- a/ppapi/proxy/plugin_resource.cc
+++ b/ppapi/proxy/plugin_resource.cc
@@ -5,7 +5,6 @@
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/resource_message_params.h"
namespace ppapi {
namespace proxy {
@@ -43,48 +42,36 @@ void PluginResource::OnReplyReceived(
}
}
-void PluginResource::SendCreateToBrowser(const IPC::Message& msg) {
- DCHECK(!sent_create_to_browser_);
- sent_create_to_browser_ = true;
- ResourceMessageCallParams params(pp_resource(),
- next_sequence_number_++);
- connection_.browser_sender->Send(
- new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
-}
-
-void PluginResource::SendCreateToRenderer(const IPC::Message& msg) {
- DCHECK(!sent_create_to_renderer_);
- sent_create_to_renderer_ = true;
- ResourceMessageCallParams params(pp_resource(),
- next_sequence_number_++);
- connection_.renderer_sender->Send(
+void PluginResource::SendCreate(Destination dest, const IPC::Message& msg) {
+ if (dest == RENDERER) {
+ DCHECK(!sent_create_to_renderer_);
+ sent_create_to_renderer_ = true;
+ } else {
+ DCHECK(!sent_create_to_browser_);
+ sent_create_to_browser_ = true;
+ }
+ ResourceMessageCallParams params(pp_resource(), next_sequence_number_++);
+ GetSender(dest)->Send(
new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
}
-void PluginResource::PostToBrowser(const IPC::Message& msg) {
- ResourceMessageCallParams params(pp_resource(),
- next_sequence_number_++);
- SendResourceCall(connection_.browser_sender, params, msg);
-}
-
-void PluginResource::PostToRenderer(const IPC::Message& msg) {
- ResourceMessageCallParams params(pp_resource(),
- next_sequence_number_++);
- SendResourceCall(connection_.renderer_sender, params, msg);
+void PluginResource::Post(Destination dest, const IPC::Message& msg) {
+ ResourceMessageCallParams params(pp_resource(), next_sequence_number_++);
+ SendResourceCall(dest, params, msg);
}
bool PluginResource::SendResourceCall(
- IPC::Sender* sender,
+ Destination dest,
const ResourceMessageCallParams& call_params,
const IPC::Message& nested_msg) {
- return sender->Send(new PpapiHostMsg_ResourceCall(call_params, nested_msg));
+ return GetSender(dest)->Send(
+ new PpapiHostMsg_ResourceCall(call_params, nested_msg));
}
int32_t PluginResource::GenericSyncCall(Destination dest,
const IPC::Message& msg,
IPC::Message* reply) {
- ResourceMessageCallParams params(pp_resource(),
- next_sequence_number_++);
+ ResourceMessageCallParams params(pp_resource(), next_sequence_number_++);
params.set_has_callback();
ResourceMessageReplyParams reply_params;
bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall(
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/printing_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698