OLD | NEW |
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/renderer/pepper/pepper_plugin_delegate_impl.h" | 10 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 void PepperBrowserConnection::SendBrowserCreate( | 38 void PepperBrowserConnection::SendBrowserCreate( |
39 int child_process_id, | 39 int child_process_id, |
40 PP_Instance instance, | 40 PP_Instance instance, |
41 const IPC::Message& nested_msg, | 41 const IPC::Message& nested_msg, |
42 const PendingResourceIDCallback& callback) { | 42 const PendingResourceIDCallback& callback) { |
43 int32_t sequence_number = GetNextSequence(); | 43 int32_t sequence_number = GetNextSequence(); |
44 pending_create_map_[sequence_number] = callback; | 44 pending_create_map_[sequence_number] = callback; |
45 ppapi::proxy::ResourceMessageCallParams params(0, sequence_number); | 45 ppapi::proxy::ResourceMessageCallParams params(0, sequence_number); |
46 plugin_delegate_->render_view()->Send( | 46 plugin_delegate_->Send( |
47 new PpapiHostMsg_CreateResourceHostFromHost( | 47 new PpapiHostMsg_CreateResourceHostFromHost( |
48 plugin_delegate_->GetRoutingID(), | 48 plugin_delegate_->routing_id(), |
49 child_process_id, | 49 child_process_id, |
50 params, | 50 params, |
51 instance, | 51 instance, |
52 nested_msg)); | 52 nested_msg)); |
53 } | 53 } |
54 | 54 |
55 void PepperBrowserConnection::SendBrowserFileRefGetInfo( | 55 void PepperBrowserConnection::SendBrowserFileRefGetInfo( |
56 int child_process_id, | 56 int child_process_id, |
57 PP_Resource resource, | 57 PP_Resource resource, |
58 const FileRefGetInfoCallback& callback) { | 58 const FileRefGetInfoCallback& callback) { |
59 int32_t sequence_number = GetNextSequence(); | 59 int32_t sequence_number = GetNextSequence(); |
60 get_info_map_[sequence_number] = callback; | 60 get_info_map_[sequence_number] = callback; |
61 ppapi::proxy::ResourceMessageCallParams params(resource, sequence_number); | 61 ppapi::proxy::ResourceMessageCallParams params(resource, sequence_number); |
62 plugin_delegate_->render_view()->Send( | 62 plugin_delegate_->Send( |
63 new PpapiHostMsg_FileRef_GetInfoForRenderer( | 63 new PpapiHostMsg_FileRef_GetInfoForRenderer( |
64 plugin_delegate_->GetRoutingID(), child_process_id, params)); | 64 plugin_delegate_->routing_id(), child_process_id, params)); |
65 } | 65 } |
66 | 66 |
67 void PepperBrowserConnection::OnMsgCreateResourceHostFromHostReply( | 67 void PepperBrowserConnection::OnMsgCreateResourceHostFromHostReply( |
68 int32_t sequence_number, | 68 int32_t sequence_number, |
69 int pending_resource_host_id) { | 69 int pending_resource_host_id) { |
70 // Check that the message is destined for the plugin this object is associated | 70 // Check that the message is destined for the plugin this object is associated |
71 // with. | 71 // with. |
72 std::map<int32_t, PendingResourceIDCallback>::iterator it = | 72 std::map<int32_t, PendingResourceIDCallback>::iterator it = |
73 pending_create_map_.find(sequence_number); | 73 pending_create_map_.find(sequence_number); |
74 if (it != pending_create_map_.end()) { | 74 if (it != pending_create_map_.end()) { |
(...skipping 27 matching lines...) Expand all Loading... |
102 // manually check. | 102 // manually check. |
103 int32_t ret = next_sequence_number_; | 103 int32_t ret = next_sequence_number_; |
104 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) | 104 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) |
105 next_sequence_number_ = 1; // Skip 0 which is invalid. | 105 next_sequence_number_ = 1; // Skip 0 which is invalid. |
106 else | 106 else |
107 next_sequence_number_++; | 107 next_sequence_number_++; |
108 return ret; | 108 return ret; |
109 } | 109 } |
110 | 110 |
111 } // namespace content | 111 } // namespace content |
OLD | NEW |