| 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/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return MessageLoopResource::GetCurrent(); | 165 return MessageLoopResource::GetCurrent(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 base::TaskRunner* PluginGlobals::GetFileTaskRunner() { | 168 base::TaskRunner* PluginGlobals::GetFileTaskRunner() { |
| 169 if (!file_thread_.get()) { | 169 if (!file_thread_.get()) { |
| 170 file_thread_.reset(new base::Thread("Plugin::File")); | 170 file_thread_.reset(new base::Thread("Plugin::File")); |
| 171 base::Thread::Options options; | 171 base::Thread::Options options; |
| 172 options.message_loop_type = base::MessageLoop::TYPE_IO; | 172 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 173 file_thread_->StartWithOptions(options); | 173 file_thread_->StartWithOptions(options); |
| 174 } | 174 } |
| 175 return file_thread_->message_loop_proxy(); | 175 return file_thread_->message_loop_proxy().get(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void PluginGlobals::MarkPluginIsActive() { | 178 void PluginGlobals::MarkPluginIsActive() { |
| 179 if (!plugin_recently_active_) { | 179 if (!plugin_recently_active_) { |
| 180 plugin_recently_active_ = true; | 180 plugin_recently_active_ = true; |
| 181 if (!GetBrowserSender() || !base::MessageLoop::current()) | 181 if (!GetBrowserSender() || !base::MessageLoop::current()) |
| 182 return; | 182 return; |
| 183 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); | 183 GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); |
| 184 DCHECK(keepalive_throttle_interval_milliseconds_); | 184 DCHECK(keepalive_throttle_interval_milliseconds_); |
| 185 GetMainThreadMessageLoop()->PostDelayedTask( | 185 GetMainThreadMessageLoop()->PostDelayedTask( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return true; | 229 return true; |
| 230 } | 230 } |
| 231 | 231 |
| 232 void PluginGlobals::OnReleaseKeepaliveThrottle() { | 232 void PluginGlobals::OnReleaseKeepaliveThrottle() { |
| 233 ppapi::ProxyLock::AssertAcquiredDebugOnly(); | 233 ppapi::ProxyLock::AssertAcquiredDebugOnly(); |
| 234 plugin_recently_active_ = false; | 234 plugin_recently_active_ = false; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace proxy | 237 } // namespace proxy |
| 238 } // namespace ppapi | 238 } // namespace ppapi |
| OLD | NEW |