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

Side by Side Diff: content/renderer/pepper/pepper_browser_connection.cc

Issue 23011018: Modify Pepper CreateResourceHostFromHost to create multiple hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/pepper_browser_connection.h" 5 #include "content/renderer/pepper/pepper_browser_connection.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 14 matching lines...) Expand all
25 PepperBrowserConnection::~PepperBrowserConnection() { 25 PepperBrowserConnection::~PepperBrowserConnection() {
26 } 26 }
27 27
28 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) { 28 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) {
29 // Check if the message is an in-process reply. 29 // Check if the message is an in-process reply.
30 if (PepperInProcessRouter::OnPluginMsgReceived(msg)) 30 if (PepperInProcessRouter::OnPluginMsgReceived(msg))
31 return true; 31 return true;
32 32
33 bool handled = true; 33 bool handled = true;
34 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg) 34 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg)
35 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostFromHostReply, 35 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostsFromHostReply,
36 OnMsgCreateResourceHostFromHostReply) 36 OnMsgCreateResourceHostsFromHostReply)
37 IPC_MESSAGE_UNHANDLED(handled = false) 37 IPC_MESSAGE_UNHANDLED(handled = false)
38 IPC_END_MESSAGE_MAP() 38 IPC_END_MESSAGE_MAP()
39 39
40 return handled; 40 return handled;
41 } 41 }
42 42
43 void PepperBrowserConnection::DidCreateInProcessInstance( 43 void PepperBrowserConnection::DidCreateInProcessInstance(
44 PP_Instance instance, 44 PP_Instance instance,
45 int render_view_id, 45 int render_view_id,
46 const GURL& document_url, 46 const GURL& document_url,
47 const GURL& plugin_url) { 47 const GURL& plugin_url) {
48 Send(new ViewHostMsg_DidCreateInProcessInstance( 48 Send(new ViewHostMsg_DidCreateInProcessInstance(
49 instance, 49 instance,
50 // Browser provides the render process id. 50 // Browser provides the render process id.
51 PepperRendererInstanceData(0, 51 PepperRendererInstanceData(0,
52 render_view_id, 52 render_view_id,
53 document_url, 53 document_url,
54 plugin_url))); 54 plugin_url)));
55 } 55 }
56 56
57 void PepperBrowserConnection::DidDeleteInProcessInstance(PP_Instance instance) { 57 void PepperBrowserConnection::DidDeleteInProcessInstance(PP_Instance instance) {
58 Send(new ViewHostMsg_DidDeleteInProcessInstance(instance)); 58 Send(new ViewHostMsg_DidDeleteInProcessInstance(instance));
59 } 59 }
60 60
61 void PepperBrowserConnection::SendBrowserCreate( 61 void PepperBrowserConnection::SendBrowserCreate(
62 int child_process_id, 62 int child_process_id,
63 PP_Instance instance, 63 PP_Instance instance,
64 const IPC::Message& nested_msg, 64 const std::vector<IPC::Message>& nested_msgs,
65 const PendingResourceIDCallback& callback) { 65 const PendingResourceIDCallback& callback) {
66 int32_t sequence_number = GetNextSequence(); 66 int32_t sequence_number = GetNextSequence();
67 pending_create_map_[sequence_number] = callback; 67 pending_create_map_[sequence_number] = callback;
68 ppapi::proxy::ResourceMessageCallParams params(0, sequence_number); 68 ppapi::proxy::ResourceMessageCallParams params(0, sequence_number);
69 Send(new PpapiHostMsg_CreateResourceHostFromHost( 69 Send(new PpapiHostMsg_CreateResourceHostsFromHost(
70 routing_id(), 70 routing_id(),
71 child_process_id, 71 child_process_id,
72 params, 72 params,
73 instance, 73 instance,
74 nested_msg)); 74 nested_msgs));
75 } 75 }
76 76
77 void PepperBrowserConnection::SendBrowserFileRefGetInfo( 77 void PepperBrowserConnection::SendBrowserFileRefGetInfo(
78 int child_process_id, 78 int child_process_id,
79 const std::vector<PP_Resource>& resources, 79 const std::vector<PP_Resource>& resources,
80 const FileRefGetInfoCallback& callback) { 80 const FileRefGetInfoCallback& callback) {
81 int32_t sequence_number = GetNextSequence(); 81 int32_t sequence_number = GetNextSequence();
82 get_info_map_[sequence_number] = callback; 82 get_info_map_[sequence_number] = callback;
83 Send(new PpapiHostMsg_FileRef_GetInfoForRenderer( 83 Send(new PpapiHostMsg_FileRef_GetInfoForRenderer(
84 routing_id(), child_process_id, sequence_number, resources)); 84 routing_id(), child_process_id, sequence_number, resources));
85 } 85 }
86 86
87 void PepperBrowserConnection::OnMsgCreateResourceHostFromHostReply( 87 void PepperBrowserConnection::OnMsgCreateResourceHostsFromHostReply(
88 int32_t sequence_number, 88 int32_t sequence_number,
89 int pending_resource_host_id) { 89 const std::vector<int>& pending_resource_host_ids) {
90 // Check that the message is destined for the plugin this object is associated 90 // Check that the message is destined for the plugin this object is associated
91 // with. 91 // with.
92 std::map<int32_t, PendingResourceIDCallback>::iterator it = 92 std::map<int32_t, PendingResourceIDCallback>::iterator it =
93 pending_create_map_.find(sequence_number); 93 pending_create_map_.find(sequence_number);
94 if (it != pending_create_map_.end()) { 94 if (it != pending_create_map_.end()) {
95 it->second.Run(pending_resource_host_id); 95 it->second.Run(pending_resource_host_ids);
96 pending_create_map_.erase(it); 96 pending_create_map_.erase(it);
97 } else { 97 } else {
98 NOTREACHED(); 98 NOTREACHED();
99 } 99 }
100 } 100 }
101 101
102 void PepperBrowserConnection::OnMsgFileRefGetInfoReply( 102 void PepperBrowserConnection::OnMsgFileRefGetInfoReply(
103 int32_t sequence_number, 103 int32_t sequence_number,
104 const std::vector<PP_Resource>& resources, 104 const std::vector<PP_Resource>& resources,
105 const std::vector<PP_FileSystemType>& types, 105 const std::vector<PP_FileSystemType>& types,
(...skipping 18 matching lines...) Expand all
124 // manually check. 124 // manually check.
125 int32_t ret = next_sequence_number_; 125 int32_t ret = next_sequence_number_;
126 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) 126 if (next_sequence_number_ == std::numeric_limits<int32_t>::max())
127 next_sequence_number_ = 1; // Skip 0 which is invalid. 127 next_sequence_number_ = 1; // Skip 0 which is invalid.
128 else 128 else
129 next_sequence_number_++; 129 next_sequence_number_++;
130 return ret; 130 return ret;
131 } 131 }
132 132
133 } // namespace content 133 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698