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

Unified Diff: content/renderer/pepper/pepper_browser_connection.cc

Issue 730603002: PPAPI: Refactor renderer side of browser host creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sequence_id->sequence_num Created 6 years, 1 month 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: content/renderer/pepper/pepper_browser_connection.cc
diff --git a/content/renderer/pepper/pepper_browser_connection.cc b/content/renderer/pepper/pepper_browser_connection.cc
index 892506ede2f22526f71e64034407459c69121ee6..b93bdeccd6b1bf4fb65a798a382b0ca241115fc9 100644
--- a/content/renderer/pepper/pepper_browser_connection.cc
+++ b/content/renderer/pepper/pepper_browser_connection.cc
@@ -13,6 +13,7 @@
#include "ipc/ipc_message_macros.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/serialized_structs.h"
namespace content {
@@ -53,27 +54,42 @@ void PepperBrowserConnection::DidDeleteInProcessInstance(PP_Instance instance) {
Send(new ViewHostMsg_DidDeleteInProcessInstance(instance));
}
-void PepperBrowserConnection::SendBrowserCreate(
+int32_t PepperBrowserConnection::SendBrowserCreate(
int child_process_id,
PP_Instance instance,
const std::vector<IPC::Message>& nested_msgs,
- const PendingResourceIDCallback& callback) {
+ const PendingResourceCallback& callback) {
int32_t sequence_number = GetNextSequence();
- pending_create_map_[sequence_number] = callback;
+ pending_create_map_.insert(
+ std::map<int32_t, PendingResource>::value_type(
+ sequence_number,
+ PendingResource(child_process_id, instance, callback)));
ppapi::proxy::ResourceMessageCallParams params(0, sequence_number);
Send(new PpapiHostMsg_CreateResourceHostsFromHost(
routing_id(), child_process_id, params, instance, nested_msgs));
+ return sequence_number;
+}
+
+PepperBrowserConnection::PendingResource::PendingResource(
+ int child_process_id_param,
+ PP_Instance instance_param,
+ const PendingResourceCallback& callback_param)
+ : child_process_id(child_process_id_param),
+ instance(instance_param),
+ callback(callback_param) {
+}
+
+PepperBrowserConnection::PendingResource::~PendingResource() {
}
void PepperBrowserConnection::OnMsgCreateResourceHostsFromHostReply(
- int32_t sequence_number,
- const std::vector<int>& pending_resource_host_ids) {
+ const ppapi::proxy::CompletedBrowserResourceHosts& hosts) {
// Check that the message is destined for the plugin this object is associated
// with.
- std::map<int32_t, PendingResourceIDCallback>::iterator it =
- pending_create_map_.find(sequence_number);
+ std::map<int32_t, PendingResource>::iterator it =
+ pending_create_map_.find(hosts.sequence_num);
if (it != pending_create_map_.end()) {
- it->second.Run(pending_resource_host_ids);
+ it->second.callback.Run(hosts);
pending_create_map_.erase(it);
} else {
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698