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

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

Issue 566243004: Revert of PPAPI: Fix GetBrowserInterface race conditions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « ppapi/proxy/plugin_globals.h ('k') | ppapi/proxy/ppapi_proxy_test.cc » ('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_globals.h" 5 #include "ppapi/proxy/plugin_globals.h"
6 6
7 #include "base/task_runner.h" 7 #include "base/task_runner.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ipc/ipc_sender.h" 10 #include "ipc/ipc_sender.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GetMainThreadMessageLoop()->PostDelayedTask( 185 GetMainThreadMessageLoop()->PostDelayedTask(
186 FROM_HERE, 186 FROM_HERE,
187 RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle, 187 RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle,
188 weak_factory_.GetWeakPtr())), 188 weak_factory_.GetWeakPtr())),
189 base::TimeDelta::FromMilliseconds( 189 base::TimeDelta::FromMilliseconds(
190 keepalive_throttle_interval_milliseconds_)); 190 keepalive_throttle_interval_milliseconds_));
191 } 191 }
192 } 192 }
193 193
194 IPC::Sender* PluginGlobals::GetBrowserSender() { 194 IPC::Sender* PluginGlobals::GetBrowserSender() {
195 // CAUTION: This function is called without the ProxyLock. See also 195 if (!browser_sender_.get()) {
196 // InterfaceList::GetInterfaceForPPB. 196 browser_sender_.reset(
197 new BrowserSender(plugin_proxy_delegate_->GetBrowserSender()));
198 }
199
197 return browser_sender_.get(); 200 return browser_sender_.get();
198 } 201 }
199 202
200 std::string PluginGlobals::GetUILanguage() { 203 std::string PluginGlobals::GetUILanguage() {
201 return plugin_proxy_delegate_->GetUILanguage(); 204 return plugin_proxy_delegate_->GetUILanguage();
202 } 205 }
203 206
204 void PluginGlobals::SetActiveURL(const std::string& url) { 207 void PluginGlobals::SetActiveURL(const std::string& url) {
205 plugin_proxy_delegate_->SetActiveURL(url); 208 plugin_proxy_delegate_->SetActiveURL(url);
206 } 209 }
207 210
208 PP_Resource PluginGlobals::CreateBrowserFont( 211 PP_Resource PluginGlobals::CreateBrowserFont(
209 Connection connection, 212 Connection connection,
210 PP_Instance instance, 213 PP_Instance instance,
211 const PP_BrowserFont_Trusted_Description& desc, 214 const PP_BrowserFont_Trusted_Description& desc,
212 const ppapi::Preferences& prefs) { 215 const ppapi::Preferences& prefs) {
213 return plugin_proxy_delegate_->CreateBrowserFont( 216 return plugin_proxy_delegate_->CreateBrowserFont(
214 connection, instance, desc, prefs); 217 connection, instance, desc, prefs);
215 } 218 }
216 219
217 void PluginGlobals::SetPluginProxyDelegate(PluginProxyDelegate* delegate) {
218 plugin_proxy_delegate_ = delegate;
219 browser_sender_.reset(
220 new BrowserSender(plugin_proxy_delegate_->GetBrowserSender()));
221 }
222
223 MessageLoopResource* PluginGlobals::loop_for_main_thread() { 220 MessageLoopResource* PluginGlobals::loop_for_main_thread() {
224 return loop_for_main_thread_.get(); 221 return loop_for_main_thread_.get();
225 } 222 }
226 223
227 void PluginGlobals::set_keepalive_throttle_interval_milliseconds(unsigned i) { 224 void PluginGlobals::set_keepalive_throttle_interval_milliseconds(unsigned i) {
228 keepalive_throttle_interval_milliseconds_ = i; 225 keepalive_throttle_interval_milliseconds_ = i;
229 } 226 }
230 227
231 bool PluginGlobals::IsPluginGlobals() const { 228 bool PluginGlobals::IsPluginGlobals() const {
232 return true; 229 return true;
233 } 230 }
234 231
235 void PluginGlobals::OnReleaseKeepaliveThrottle() { 232 void PluginGlobals::OnReleaseKeepaliveThrottle() {
236 ppapi::ProxyLock::AssertAcquiredDebugOnly(); 233 ppapi::ProxyLock::AssertAcquiredDebugOnly();
237 plugin_recently_active_ = false; 234 plugin_recently_active_ = false;
238 } 235 }
239 236
240 } // namespace proxy 237 } // namespace proxy
241 } // namespace ppapi 238 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_globals.h ('k') | ppapi/proxy/ppapi_proxy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698