OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TREES_REMOTE_PROTO_CHANNEL_H_ | 5 #ifndef CC_TREES_REMOTE_PROTO_CHANNEL_H_ |
6 #define CC_TREES_REMOTE_PROTO_CHANNEL_H_ | 6 #define CC_TREES_REMOTE_PROTO_CHANNEL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 namespace proto { | 12 namespace proto { |
13 class CompositorMessage; | 13 class CompositorMessage; |
14 } | 14 } |
15 | 15 |
16 // Provides a bridge for getting compositor protobuf messages to/from the | 16 // Provides a bridge for getting compositor protobuf messages to/from the |
17 // outside world. | 17 // outside world. |
18 class RemoteProtoChannel { | 18 class RemoteProtoChannel { |
19 public: | 19 public: |
20 // Meant to be implemented by a RemoteChannel that needs to receive and parse | 20 // Meant to be implemented by a RemoteChannel that needs to receive and parse |
21 // incoming protobufs. | 21 // incoming protobufs. |
22 class ProtoReceiver { | 22 class ProtoReceiver { |
23 public: | 23 public: |
| 24 // TODO(khushalsagar): This should probably include a closure that returns |
| 25 // the status of processing this proto. |
24 virtual void OnProtoReceived( | 26 virtual void OnProtoReceived( |
25 scoped_ptr<proto::CompositorMessage> proto) = 0; | 27 scoped_ptr<proto::CompositorMessage> proto) = 0; |
26 | 28 |
27 protected: | 29 protected: |
28 virtual ~ProtoReceiver() {} | 30 virtual ~ProtoReceiver() {} |
29 }; | 31 }; |
30 | 32 |
| 33 // Called by the ProtoReceiver. The RemoteProtoChannel must outlive its |
| 34 // receiver. |
31 virtual void SetProtoReceiver(ProtoReceiver* receiver) = 0; | 35 virtual void SetProtoReceiver(ProtoReceiver* receiver) = 0; |
| 36 |
32 virtual void SendCompositorProto(const proto::CompositorMessage& proto) = 0; | 37 virtual void SendCompositorProto(const proto::CompositorMessage& proto) = 0; |
33 | 38 |
34 protected: | 39 protected: |
35 virtual ~RemoteProtoChannel() {} | 40 virtual ~RemoteProtoChannel() {} |
36 }; | 41 }; |
37 | 42 |
38 } // namespace cc | 43 } // namespace cc |
39 | 44 |
40 #endif // CC_TREES_REMOTE_PROTO_CHANNEL_H_ | 45 #endif // CC_TREES_REMOTE_PROTO_CHANNEL_H_ |
OLD | NEW |