| 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_globals.h" | 5 #include "ppapi/proxy/plugin_globals.h" |
| 6 | 6 |
| 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 7 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
| 8 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 9 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
| 10 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
| 11 #include "ppapi/proxy/plugin_dispatcher.h" | 13 #include "ppapi/proxy/plugin_dispatcher.h" |
| 12 #include "ppapi/proxy/plugin_message_filter.h" | 14 #include "ppapi/proxy/plugin_message_filter.h" |
| 13 #include "ppapi/proxy/plugin_proxy_delegate.h" | 15 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 14 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 15 #include "ppapi/proxy/ppb_message_loop_proxy.h" | 17 #include "ppapi/proxy/ppb_message_loop_proxy.h" |
| 16 #include "ppapi/proxy/resource_reply_thread_registrar.h" | 18 #include "ppapi/proxy/resource_reply_thread_registrar.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return MessageLoopResource::GetCurrent(); | 175 return MessageLoopResource::GetCurrent(); |
| 174 } | 176 } |
| 175 | 177 |
| 176 base::TaskRunner* PluginGlobals::GetFileTaskRunner() { | 178 base::TaskRunner* PluginGlobals::GetFileTaskRunner() { |
| 177 if (!file_thread_.get()) { | 179 if (!file_thread_.get()) { |
| 178 file_thread_.reset(new base::Thread("Plugin::File")); | 180 file_thread_.reset(new base::Thread("Plugin::File")); |
| 179 base::Thread::Options options; | 181 base::Thread::Options options; |
| 180 options.message_loop_type = base::MessageLoop::TYPE_IO; | 182 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 181 file_thread_->StartWithOptions(options); | 183 file_thread_->StartWithOptions(options); |
| 182 } | 184 } |
| 183 return file_thread_->message_loop_proxy().get(); | 185 return file_thread_->task_runner().get(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void PluginGlobals::MarkPluginIsActive() { | 188 void PluginGlobals::MarkPluginIsActive() { |
| 187 if (!plugin_recently_active_) { | 189 if (!plugin_recently_active_) { |
| 188 plugin_recently_active_ = true; | 190 plugin_recently_active_ = true; |
| 189 if (!GetBrowserSender() || !base::MessageLoop::current()) | 191 if (!GetBrowserSender() || !base::MessageLoop::current()) |
| 190 return; | 192 return; |
| 191 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); | 193 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); |
| 192 DCHECK(keepalive_throttle_interval_milliseconds_); | 194 DCHECK(keepalive_throttle_interval_milliseconds_); |
| 193 GetMainThreadMessageLoop()->PostDelayedTask( | 195 GetMainThreadMessageLoop()->PostDelayedTask( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 return true; | 259 return true; |
| 258 } | 260 } |
| 259 | 261 |
| 260 void PluginGlobals::OnReleaseKeepaliveThrottle() { | 262 void PluginGlobals::OnReleaseKeepaliveThrottle() { |
| 261 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 263 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 262 plugin_recently_active_ = false; | 264 plugin_recently_active_ = false; |
| 263 } | 265 } |
| 264 | 266 |
| 265 } // namespace proxy | 267 } // namespace proxy |
| 266 } // namespace ppapi | 268 } // namespace ppapi |
| OLD | NEW |