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

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

Issue 20987009: Rename PepperPluginDelegateImpl to PepperHelperImpl after getting rid of the PluginDelegate interfa… (Closed) Base URL: svn://chrome-svn/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 (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 "content/renderer/pepper/pepper_broker.h" 5 #include "content/renderer/pepper/pepper_broker.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" 8 #include "content/renderer/pepper/pepper_helper_impl.h"
9 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" 9 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h"
10 #include "content/renderer/pepper/plugin_module.h" 10 #include "content/renderer/pepper/plugin_module.h"
11 #include "content/renderer/pepper/ppb_broker_impl.h" 11 #include "content/renderer/pepper/ppb_broker_impl.h"
12 #include "content/renderer/pepper/renderer_restrict_dispatch_group.h" 12 #include "content/renderer/pepper/renderer_restrict_dispatch_group.h"
13 #include "ipc/ipc_channel_handle.h" 13 #include "ipc/ipc_channel_handle.h"
14 #include "ppapi/proxy/broker_dispatcher.h" 14 #include "ppapi/proxy/broker_dispatcher.h"
15 #include "ppapi/proxy/ppapi_messages.h" 15 #include "ppapi/proxy/ppapi_messages.h"
16 #include "ppapi/shared_impl/platform_file.h" 16 #include "ppapi/shared_impl/platform_file.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // The handle could still leak if Send succeeded but the IPC later failed. 101 // The handle could still leak if Send succeeded but the IPC later failed.
102 base::SyncSocket temp_socket( 102 base::SyncSocket temp_socket(
103 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); 103 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle));
104 return PP_ERROR_FAILED; 104 return PP_ERROR_FAILED;
105 } 105 }
106 106
107 return result; 107 return result;
108 } 108 }
109 109
110 PepperBroker::PepperBroker(PluginModule* plugin_module, 110 PepperBroker::PepperBroker(PluginModule* plugin_module,
111 PepperPluginDelegateImpl* delegate) 111 PepperHelperImpl* helper)
112 : plugin_module_(plugin_module), 112 : plugin_module_(plugin_module),
113 delegate_(delegate->AsWeakPtr()) { 113 helper_(helper->AsWeakPtr()) {
114 DCHECK(plugin_module_); 114 DCHECK(plugin_module_);
115 DCHECK(delegate_.get()); 115 DCHECK(helper_.get());
116 116
117 plugin_module_->SetBroker(this); 117 plugin_module_->SetBroker(this);
118 } 118 }
119 119
120 PepperBroker::~PepperBroker() { 120 PepperBroker::~PepperBroker() {
121 ReportFailureToClients(PP_ERROR_ABORTED); 121 ReportFailureToClients(PP_ERROR_ABORTED);
122 plugin_module_->SetBroker(NULL); 122 plugin_module_->SetBroker(NULL);
123 plugin_module_ = NULL; 123 plugin_module_ = NULL;
124 } 124 }
125 125
(...skipping 27 matching lines...) Expand all
153 // called to remove this object from pending_connect_broker_. 153 // called to remove this object from pending_connect_broker_.
154 // Before the broker is connected, clients must either be in 154 // Before the broker is connected, clients must either be in
155 // pending_connects_ or not yet associated with this object. Thus, if this 155 // pending_connects_ or not yet associated with this object. Thus, if this
156 // object is in pending_connect_broker_, there can be no associated clients 156 // object is in pending_connect_broker_, there can be no associated clients
157 // once pending_connects_ is empty and it is thus safe to remove this from 157 // once pending_connects_ is empty and it is thus safe to remove this from
158 // pending_connect_broker_. Doing so will cause this object to be deleted, 158 // pending_connect_broker_. Doing so will cause this object to be deleted,
159 // removing it from the PluginModule. Any new clients will create a new 159 // removing it from the PluginModule. Any new clients will create a new
160 // instance of this object. 160 // instance of this object.
161 // This doesn't solve all potential problems, but it helps with the ones 161 // This doesn't solve all potential problems, but it helps with the ones
162 // we can influence. 162 // we can influence.
163 if (delegate_.get()) { 163 if (helper_.get()) {
164 bool stopped = delegate_->StopWaitingForBrokerConnection(this); 164 bool stopped = helper_->StopWaitingForBrokerConnection(this);
165 165
166 // Verify the assumption that there are no references other than the one 166 // Verify the assumption that there are no references other than the one
167 // |client| holds, which will be released below. 167 // |client| holds, which will be released below.
168 DCHECK(!stopped || HasOneRef()); 168 DCHECK(!stopped || HasOneRef());
169 } 169 }
170 } 170 }
171 171
172 // Release the reference added in Connect(). 172 // Release the reference added in Connect().
173 // This must be the last statement because it may delete this object. 173 // This must be the last statement because it may delete this object.
174 Release(); 174 Release();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing 278 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing
279 // client and plugin_socket.release(), then return. 279 // client and plugin_socket.release(), then return.
280 // That message handler will then call client->BrokerConnected() with the 280 // That message handler will then call client->BrokerConnected() with the
281 // saved pipe handle. 281 // saved pipe handle.
282 // Temporarily, just call back. 282 // Temporarily, just call back.
283 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); 283 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result);
284 } 284 }
285 285
286 } // namespace content 286 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_broker.h ('k') | content/renderer/pepper/pepper_broker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698