summaryrefslogtreecommitdiffstats
path: root/cc/trees/remote_proto_channel.h
blob: 76141a9089405ceb1b552fbef2a51476356723b9 (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
41
42
43
44
45
46
// 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 CC_TREES_REMOTE_PROTO_CHANNEL_H_
#define CC_TREES_REMOTE_PROTO_CHANNEL_H_

#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"

namespace cc {

namespace proto {
class CompositorMessage;
}

// Provides a bridge for getting compositor protobuf messages to/from the
// outside world.
class CC_EXPORT RemoteProtoChannel {
 public:
  // Meant to be implemented by a RemoteChannel that needs to receive and parse
  // incoming protobufs.
  class CC_EXPORT ProtoReceiver {
   public:
    // TODO(khushalsagar): This should probably include a closure that returns
    // the status of processing this proto. See crbug/576974
    virtual void OnProtoReceived(
        scoped_ptr<proto::CompositorMessage> proto) = 0;

   protected:
    virtual ~ProtoReceiver() {}
  };

  // Called by the ProtoReceiver. The RemoteProtoChannel must outlive its
  // receiver.
  virtual void SetProtoReceiver(ProtoReceiver* receiver) = 0;

  virtual void SendCompositorProto(const proto::CompositorMessage& proto) = 0;

 protected:
  virtual ~RemoteProtoChannel() {}
};

}  // namespace cc

#endif  // CC_TREES_REMOTE_PROTO_CHANNEL_H_