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

Side by Side Diff: ppapi/proxy/plugin_resource.cc

Issue 11414147: Add ability to create pending resource hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698