summaryrefslogtreecommitdiffstats
path: root/chromeos/binder/object.h
blob: 21b99f07439b6a46906bbb84db192af865e2166b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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_