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

Unified Diff: remoting/base/plugin_message_loop_proxy.cc

Issue 10830016: Replace PluginMessageLoopProxy with PluginThreadTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/base/plugin_message_loop_proxy.h ('k') | remoting/base/plugin_thread_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/plugin_message_loop_proxy.cc
diff --git a/remoting/base/plugin_message_loop_proxy.cc b/remoting/base/plugin_message_loop_proxy.cc
deleted file mode 100644
index ad595c8c9418ac889371ad087546fd0aad34876e..0000000000000000000000000000000000000000
--- a/remoting/base/plugin_message_loop_proxy.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/base/plugin_message_loop_proxy.h"
-
-#include "base/bind.h"
-
-namespace remoting {
-
-PluginMessageLoopProxy::PluginMessageLoopProxy(Delegate* delegate)
- : plugin_thread_id_(base::PlatformThread::CurrentId()),
- delegate_(delegate) {
-}
-
-PluginMessageLoopProxy::~PluginMessageLoopProxy() {
-}
-
-void PluginMessageLoopProxy::Detach() {
- base::AutoLock auto_lock(lock_);
- if (delegate_) {
- DCHECK(BelongsToCurrentThread());
- delegate_ = NULL;
- }
-}
-
-bool PluginMessageLoopProxy::PostDelayedTask(
- const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay) {
- base::AutoLock auto_lock(lock_);
- if (!delegate_)
- return false;
-
- base::Closure* springpad_closure = new base::Closure(base::Bind(
- &PluginMessageLoopProxy::RunClosureIf, this, task));
- return delegate_->RunOnPluginThread(
- delay, &PluginMessageLoopProxy::TaskSpringboard, springpad_closure);
-}
-
-bool PluginMessageLoopProxy::PostNonNestableDelayedTask(
- const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay) {
- // All tasks running on this message loop are non-nestable.
- return PostDelayedTask(from_here, task, delay);
-}
-
-bool PluginMessageLoopProxy::RunsTasksOnCurrentThread() const {
- // In pepper plugins ideally we should use pp::Core::IsMainThread,
- // but it is problematic because we would need to keep reference to
- // Core somewhere, e.g. make the delegate ref-counted.
- return base::PlatformThread::CurrentId() == plugin_thread_id_;
-}
-
-// static
-void PluginMessageLoopProxy::TaskSpringboard(void* data) {
- base::Closure* task = reinterpret_cast<base::Closure*>(data);
- task->Run();
- delete task;
-}
-
-void PluginMessageLoopProxy::RunClosureIf(const base::Closure& task) {
- // |delegate_| can be changed only from our thread, so it's safe to
- // access it without acquiring |lock_|.
- if (delegate_)
- task.Run();
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/base/plugin_message_loop_proxy.h ('k') | remoting/base/plugin_thread_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698