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

Unified Diff: remoting/base/task_thread_proxy.h

Issue 7355011: Modify Chromoting logging to hook into base logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments + thread proxy Created 9 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
Index: remoting/base/task_thread_proxy.h
diff --git a/remoting/base/task_thread_proxy.h b/remoting/base/task_thread_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..de410000e5da6d49daee7859ec4999c01d11b8e5
--- /dev/null
+++ b/remoting/base/task_thread_proxy.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
Sergey Ulanov 2011/08/02 01:08:32 year
garykac 2011/08/02 02:13:31 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_BASE_TASK_THREAD_PROXY_H_
+#define REMOTING_BASE_TASK_THREAD_PROXY_H_
+
+#include "base/bind.h"
+
+namespace remoting {
+
+class TaskThreadProxy : public base::RefCountedThreadSafe<TaskThreadProxy> {
Sergey Ulanov 2011/08/02 01:08:32 Please add some comments that explain when this cl
garykac 2011/08/02 02:13:31 Done.
+ public:
+ TaskThreadProxy(MessageLoop* loop)
+ : message_loop_(loop) {
Sergey Ulanov 2011/08/02 01:08:32 Move implementation to task_thread_proxy.cc, other
garykac 2011/08/02 02:13:31 Done.
+ }
+
+ // Detach is called when the message loop is about to be destroyed.
Sergey Ulanov 2011/08/02 01:08:32 This comment is not correct. This method should be
garykac 2011/08/02 02:13:31 Done.
+ void Detach() {
+ message_loop_ = NULL;
+ }
+
+ void Call(const base::Closure& closure) {
+ if (message_loop_) {
+ message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &TaskThreadProxy::CallClosure, closure));
+ }
+ }
+
+ private:
+ friend class base::RefCountedThreadSafe<TaskThreadProxy>;
+
+ virtual ~TaskThreadProxy() {
+ }
+
+ void CallClosure(const base::Closure& closure) {
+ if (message_loop_)
+ closure.Run();
+ }
+
+ MessageLoop* message_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(TaskThreadProxy);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_TASK_THREAD_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698