Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_BASE_TASK_THREAD_PROXY_H_ | |
| 6 #define REMOTING_BASE_TASK_THREAD_PROXY_H_ | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 | |
| 10 namespace remoting { | |
| 11 | |
| 12 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.
| |
| 13 public: | |
| 14 TaskThreadProxy(MessageLoop* loop) | |
| 15 : 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.
| |
| 16 } | |
| 17 | |
| 18 // 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.
| |
| 19 void Detach() { | |
| 20 message_loop_ = NULL; | |
| 21 } | |
| 22 | |
| 23 void Call(const base::Closure& closure) { | |
| 24 if (message_loop_) { | |
| 25 message_loop_->PostTask(FROM_HERE, NewRunnableMethod( | |
| 26 this, &TaskThreadProxy::CallClosure, closure)); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 private: | |
| 31 friend class base::RefCountedThreadSafe<TaskThreadProxy>; | |
| 32 | |
| 33 virtual ~TaskThreadProxy() { | |
| 34 } | |
| 35 | |
| 36 void CallClosure(const base::Closure& closure) { | |
| 37 if (message_loop_) | |
| 38 closure.Run(); | |
| 39 } | |
| 40 | |
| 41 MessageLoop* message_loop_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(TaskThreadProxy); | |
| 44 }; | |
| 45 | |
| 46 } // namespace remoting | |
| 47 | |
| 48 #endif // REMOTING_BASE_TASK_THREAD_PROXY_H_ | |
| OLD | NEW |