OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/proxy/plugin_resource.h" | 5 #include "ppapi/proxy/plugin_resource.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 sent_create_to_renderer_ = true; | 74 sent_create_to_renderer_ = true; |
75 } else { | 75 } else { |
76 DCHECK(!sent_create_to_browser_); | 76 DCHECK(!sent_create_to_browser_); |
77 sent_create_to_browser_ = true; | 77 sent_create_to_browser_ = true; |
78 } | 78 } |
79 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); | 79 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); |
80 GetSender(dest)->Send( | 80 GetSender(dest)->Send( |
81 new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg)); | 81 new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg)); |
82 } | 82 } |
83 | 83 |
| 84 void PluginResource::AttachToPendingHost(Destination dest, |
| 85 int pending_host_id) { |
| 86 // Connecting to a pending host is a replacement for "create". |
| 87 if (dest == RENDERER) { |
| 88 DCHECK(!sent_create_to_renderer_); |
| 89 sent_create_to_renderer_ = true; |
| 90 } else { |
| 91 DCHECK(!sent_create_to_browser_); |
| 92 sent_create_to_browser_ = true; |
| 93 } |
| 94 GetSender(dest)->Send( |
| 95 new PpapiHostMsg_AttachToPendingHost(pp_resource(), pending_host_id)); |
| 96 } |
| 97 |
84 void PluginResource::Post(Destination dest, const IPC::Message& msg) { | 98 void PluginResource::Post(Destination dest, const IPC::Message& msg) { |
85 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); | 99 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); |
86 SendResourceCall(dest, params, msg); | 100 SendResourceCall(dest, params, msg); |
87 } | 101 } |
88 | 102 |
89 bool PluginResource::SendResourceCall( | 103 bool PluginResource::SendResourceCall( |
90 Destination dest, | 104 Destination dest, |
91 const ResourceMessageCallParams& call_params, | 105 const ResourceMessageCallParams& call_params, |
92 const IPC::Message& nested_msg) { | 106 const IPC::Message& nested_msg) { |
93 return GetSender(dest)->Send( | 107 return GetSender(dest)->Send( |
(...skipping 20 matching lines...) Expand all Loading... |
114 int32_t ret = next_sequence_number_; | 128 int32_t ret = next_sequence_number_; |
115 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) | 129 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) |
116 next_sequence_number_ = 1; // Skip 0 which is invalid. | 130 next_sequence_number_ = 1; // Skip 0 which is invalid. |
117 else | 131 else |
118 next_sequence_number_++; | 132 next_sequence_number_++; |
119 return ret; | 133 return ret; |
120 } | 134 } |
121 | 135 |
122 } // namespace proxy | 136 } // namespace proxy |
123 } // namespace ppapi | 137 } // namespace ppapi |
OLD | NEW |