Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 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 CHROMEOS_BINDER_THREAD_H_ | |
| 6 #define CHROMEOS_BINDER_THREAD_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/message_loop/message_loop.h" | |
| 10 #include "base/threading/thread.h" | |
| 11 #include "chromeos/chromeos_export.h" | |
| 12 | |
| 13 namespace binder { | |
| 14 | |
| 15 class CommandBroker; | |
| 16 class Driver; | |
| 17 | |
| 18 // Thread manages binder-related resources and handles incoming binder commands. | |
|
satorux1
2016/01/14 05:47:16
Also document that this opens the binder driver?
hashimoto
2016/01/14 06:24:29
Done.
| |
| 19 class CHROMEOS_EXPORT Thread : public base::Thread, | |
|
satorux1
2016/01/13 04:33:20
This is called 'Thread' inside of the 'binder' nam
hashimoto
2016/01/13 05:46:46
binder::Thread is a "binder thread" in the same se
| |
| 20 public base::MessageLoopForIO::Watcher { | |
|
satorux1
2016/01/14 05:47:16
Maybe IpcThread?
hashimoto
2016/01/14 06:24:29
Done.
| |
| 21 public: | |
| 22 Thread(); | |
| 23 ~Thread() override; | |
| 24 | |
| 25 Driver* driver() { return driver_.get(); } | |
| 26 CommandBroker* command_broker() { return command_broker_.get(); } | |
| 27 bool initialized() const { return initialized_; } | |
| 28 | |
| 29 // Starts this thread. | |
|
satorux1
2016/01/13 04:33:21
document the return value?
hashimoto
2016/01/13 05:46:46
Done.
| |
| 30 bool Start(); | |
| 31 | |
| 32 // base::MessageLoopIO::Watcher override: | |
| 33 void OnFileCanReadWithoutBlocking(int fd) override; | |
| 34 void OnFileCanWriteWithoutBlocking(int fd) override; | |
| 35 | |
| 36 protected: | |
| 37 // base::Thread override: | |
|
satorux1
2016/01/13 04:33:21
nit: 'overrides' may be a bit more common?
hashimoto
2016/01/13 05:46:46
Done.
| |
| 38 void Init() override; | |
| 39 void CleanUp() override; | |
| 40 | |
| 41 private: | |
| 42 scoped_ptr<Driver> driver_; | |
| 43 scoped_ptr<CommandBroker> command_broker_; | |
| 44 scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> watcher_; | |
| 45 bool initialized_ = false; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(Thread); | |
| 48 }; | |
| 49 | |
| 50 } // namespace binder | |
| 51 | |
| 52 #endif // CHROMEOS_BINDER_THREAD_H_ | |
| OLD | NEW |