OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_TREES_REMOTE_CHANNEL_HOST_H_ |
| 6 #define CC_TREES_REMOTE_CHANNEL_HOST_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_checker.h" |
| 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/raster/task_graph_runner.h" |
| 12 #include "cc/trees/remote_channel_host_client.h" |
| 13 #include "cc/trees/remote_channel_impl.h" |
| 14 #include "cc/trees/remote_proto_channel.h" |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 class CC_EXPORT RemoteChannelHost : public RemoteProtoChannel::ProtoReceiver { |
| 19 public: |
| 20 static scoped_ptr<RemoteChannelHost> Create( |
| 21 RemoteProtoChannel* remote_proto_channel, |
| 22 RemoteChannelHostClient* client, |
| 23 TaskGraphRunner* task_graph_runner, |
| 24 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 25 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 26 |
| 27 ~RemoteChannelHost() override; |
| 28 |
| 29 // TODO(khushalsagar): Add APIs for handling output surface requests and |
| 30 // visibility changes from the client. |
| 31 |
| 32 // Called by RemoteChannelImpl. |
| 33 void SendProto(const proto::CompositorMessage& proto); |
| 34 |
| 35 protected: |
| 36 RemoteChannelHost( |
| 37 RemoteProtoChannel* remote_proto_channel, |
| 38 RemoteChannelHostClient* client, |
| 39 TaskGraphRunner* task_graph_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 41 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 42 |
| 43 // Virtual for testing. |
| 44 virtual scoped_ptr<RemoteChannelImpl> CreateRemoteChannelImpl( |
| 45 RemoteChannelHost* remote_channel_host, |
| 46 TaskGraphRunner* task_graph_runner, |
| 47 const LayerTreeSettings& settings, |
| 48 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 49 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 50 |
| 51 private: |
| 52 // RemoteProtoChannel::ProtoReceiver implementation. |
| 53 void OnProtoReceived(scoped_ptr<proto::CompositorMessage> proto) override; |
| 54 |
| 55 void InitializeImpl(const proto::InitializeImpl& proto); |
| 56 |
| 57 RemoteProtoChannel* remote_proto_channel_; |
| 58 RemoteChannelHostClient* client_; |
| 59 |
| 60 // These holds a valid value only until the initialize message is received |
| 61 // and the RemoteChannelImpl is created in Initialize(). |
| 62 TaskGraphRunner* task_graph_runner_; |
| 63 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 64 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 65 |
| 66 base::ThreadChecker main_thread_checker_; |
| 67 |
| 68 scoped_ptr<RemoteChannelImpl> remote_channel_impl_; |
| 69 |
| 70 // Set when a shutdown message is received and the RemoteChannelImpl is |
| 71 // destroyed. |
| 72 bool did_shutdown_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(RemoteChannelHost); |
| 75 }; |
| 76 |
| 77 } // namespace cc |
| 78 |
| 79 #endif // CC_TREES_REMOTE_CHANNEL_HOST_H_ |
OLD | NEW |