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

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

Issue 2407393002: Remove MessageLoop::current() from ppapi/proxy. (Closed)
Patch Set: fix test error Created 4 years, 2 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 | « no previous file | ppapi/proxy/proxy_completion_callback_factory.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_globals.h" 5 #include "ppapi/proxy/plugin_globals.h"
6 6
7 #include "base/location.h"
8 #include "base/macros.h" 7 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/task_runner.h" 8 #include "base/task_runner.h"
11 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "base/threading/thread_task_runner_handle.h"
12 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
13 #include "ipc/ipc_sender.h" 12 #include "ipc/ipc_sender.h"
14 #include "ppapi/proxy/plugin_dispatcher.h" 13 #include "ppapi/proxy/plugin_dispatcher.h"
15 #include "ppapi/proxy/plugin_message_filter.h" 14 #include "ppapi/proxy/plugin_message_filter.h"
16 #include "ppapi/proxy/plugin_proxy_delegate.h" 15 #include "ppapi/proxy/plugin_proxy_delegate.h"
17 #include "ppapi/proxy/ppapi_messages.h" 16 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/proxy/ppb_message_loop_proxy.h" 17 #include "ppapi/proxy/ppb_message_loop_proxy.h"
19 #include "ppapi/proxy/resource_reply_thread_registrar.h" 18 #include "ppapi/proxy/resource_reply_thread_registrar.h"
20 #include "ppapi/proxy/udp_socket_filter.h" 19 #include "ppapi/proxy/udp_socket_filter.h"
21 #include "ppapi/shared_impl/ppapi_constants.h" 20 #include "ppapi/shared_impl/ppapi_constants.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 base::Thread::Options options; 181 base::Thread::Options options;
183 options.message_loop_type = base::MessageLoop::TYPE_IO; 182 options.message_loop_type = base::MessageLoop::TYPE_IO;
184 file_thread_->StartWithOptions(options); 183 file_thread_->StartWithOptions(options);
185 } 184 }
186 return file_thread_->task_runner().get(); 185 return file_thread_->task_runner().get();
187 } 186 }
188 187
189 void PluginGlobals::MarkPluginIsActive() { 188 void PluginGlobals::MarkPluginIsActive() {
190 if (!plugin_recently_active_) { 189 if (!plugin_recently_active_) {
191 plugin_recently_active_ = true; 190 plugin_recently_active_ = true;
192 if (!GetBrowserSender() || !base::MessageLoop::current()) 191 if (!GetBrowserSender() || !base::ThreadTaskRunnerHandle::IsSet())
193 return; 192 return;
194 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); 193 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive());
195 DCHECK(keepalive_throttle_interval_milliseconds_); 194 DCHECK(keepalive_throttle_interval_milliseconds_);
196 GetMainThreadMessageLoop()->PostDelayedTask( 195 GetMainThreadMessageLoop()->PostDelayedTask(
197 FROM_HERE, 196 FROM_HERE,
198 RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle, 197 RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle,
199 weak_factory_.GetWeakPtr())), 198 weak_factory_.GetWeakPtr())),
200 base::TimeDelta::FromMilliseconds( 199 base::TimeDelta::FromMilliseconds(
201 keepalive_throttle_interval_milliseconds_)); 200 keepalive_throttle_interval_milliseconds_));
202 } 201 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return true; 259 return true;
261 } 260 }
262 261
263 void PluginGlobals::OnReleaseKeepaliveThrottle() { 262 void PluginGlobals::OnReleaseKeepaliveThrottle() {
264 ppapi::ProxyLock::AssertAcquiredDebugOnly(); 263 ppapi::ProxyLock::AssertAcquiredDebugOnly();
265 plugin_recently_active_ = false; 264 plugin_recently_active_ = false;
266 } 265 }
267 266
268 } // namespace proxy 267 } // namespace proxy
269 } // namespace ppapi 268 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/proxy_completion_callback_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698