summaryrefslogtreecommitdiffstats
path: root/chromeos/binder/object.h
diff options
context:
space:
mode:
authorhashimoto <hashimoto@chromium.org>2016-01-05 23:22:48 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-06 07:23:33 +0000
commitec030a244f07d0ad39cede281af9e5817bf4094b (patch)
tree411df5fecd81769cdc688be91dac16756659d071 /chromeos/binder/object.h
parentb7c3414768afff35204a6c6b869c47d90d3953e0 (diff)
downloadchromium_src-ec030a244f07d0ad39cede281af9e5817bf4094b.zip
chromium_src-ec030a244f07d0ad39cede281af9e5817bf4094b.tar.gz
chromium_src-ec030a244f07d0ad39cede281af9e5817bf4094b.tar.bz2
Add binder::Object
Object is the base class of LocalObject and RemoteObject. LocalObject handles incoming transactions by actually implementing the behavior. RemoteObject transacts with an object living in a different process. BUG=563282 Review URL: https://codereview.chromium.org/1538813002 Cr-Commit-Position: refs/heads/master@{#367790}
Diffstat (limited to 'chromeos/binder/object.h')
-rw-r--r--chromeos/binder/object.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/chromeos/binder/object.h b/chromeos/binder/object.h
new file mode 100644
index 0000000..21b99f0
--- /dev/null
+++ b/chromeos/binder/object.h
@@ -0,0 +1,40 @@
+// 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_OBJECT_H_
+#define CHROMEOS_BINDER_OBJECT_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace binder {
+
+class CommandBroker;
+class TransactionData;
+
+// An object to perform a transaction.
+class Object : public base::RefCountedThreadSafe<Object> {
+ public:
+ // Type of an object.
+ enum Type {
+ TYPE_LOCAL, // This object lives in this process.
+ TYPE_REMOTE, // This object lives in a remote process.
+ };
+
+ // Returns the type of this object.
+ virtual Type GetType() const = 0;
+
+ // Performs a transaction.
+ virtual bool Transact(CommandBroker* command_broker,
+ const TransactionData& data,
+ scoped_ptr<TransactionData>* reply) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<Object>;
+ virtual ~Object() {}
+};
+
+} // namespace binder
+
+#endif // CHROMEOS_BINDER_OBJECT_H_