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

Unified Diff: chromeos/binder/thread.h

Issue 1575313002: Add CommandBroker::OnTransaction to handle incoming transactions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: chromeos/binder/thread.h
diff --git a/chromeos/binder/thread.h b/chromeos/binder/thread.h
new file mode 100644
index 0000000000000000000000000000000000000000..deb522df944f53d26a77cccb9fded26f9e3b576c
--- /dev/null
+++ b/chromeos/binder/thread.h
@@ -0,0 +1,52 @@
+// Copyright 2015 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.
+
+#ifndef CHROMEOS_BINDER_THREAD_H_
+#define CHROMEOS_BINDER_THREAD_H_
+
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "base/threading/thread.h"
+#include "chromeos/chromeos_export.h"
+
+namespace binder {
+
+class CommandBroker;
+class Driver;
+
+// 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.
+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
+ public base::MessageLoopForIO::Watcher {
satorux1 2016/01/14 05:47:16 Maybe IpcThread?
hashimoto 2016/01/14 06:24:29 Done.
+ public:
+ Thread();
+ ~Thread() override;
+
+ Driver* driver() { return driver_.get(); }
+ CommandBroker* command_broker() { return command_broker_.get(); }
+ bool initialized() const { return initialized_; }
+
+ // Starts this thread.
satorux1 2016/01/13 04:33:21 document the return value?
hashimoto 2016/01/13 05:46:46 Done.
+ bool Start();
+
+ // base::MessageLoopIO::Watcher override:
+ void OnFileCanReadWithoutBlocking(int fd) override;
+ void OnFileCanWriteWithoutBlocking(int fd) override;
+
+ protected:
+ // 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.
+ void Init() override;
+ void CleanUp() override;
+
+ private:
+ scoped_ptr<Driver> driver_;
+ scoped_ptr<CommandBroker> command_broker_;
+ scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> watcher_;
+ bool initialized_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(Thread);
+};
+
+} // namespace binder
+
+#endif // CHROMEOS_BINDER_THREAD_H_

Powered by Google App Engine
This is Rietveld 408576698