OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHANNEL_MAIN_H_ | 5 #ifndef CC_TREES_REMOTE_CHANNEL_MAIN_H_ |
6 #define CC_TREES_REMOTE_CHANNEL_MAIN_H_ | 6 #define CC_TREES_REMOTE_CHANNEL_MAIN_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/trees/channel_main.h" | 10 #include "cc/trees/channel_main.h" |
11 #include "cc/trees/remote_proto_channel.h" | 11 #include "cc/trees/remote_proto_channel.h" |
12 #include "cc/trees/task_runner_provider.h" | 12 #include "cc/trees/task_runner_provider.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 class ProxyMain; | 15 class ProxyMain; |
16 | 16 |
17 namespace proto { | 17 namespace proto { |
18 class CompositorMessage; | 18 class CompositorMessage; |
19 class CompositorMessageToMain; | 19 class CompositorMessageToMain; |
20 } | 20 } |
21 | 21 |
22 class CC_EXPORT RemoteChannelMain : public ChannelMain, | 22 class CC_EXPORT RemoteChannelMain : public ChannelMain, |
23 public RemoteProtoChannel::ProtoReceiver { | 23 public RemoteProtoChannel::ProtoReceiver { |
24 public: | 24 public: |
25 static scoped_ptr<RemoteChannelMain> Create( | 25 static std::unique_ptr<RemoteChannelMain> Create( |
26 RemoteProtoChannel* remote_proto_channel, | 26 RemoteProtoChannel* remote_proto_channel, |
27 ProxyMain* proxy_main, | 27 ProxyMain* proxy_main, |
28 TaskRunnerProvider* task_runner_provider); | 28 TaskRunnerProvider* task_runner_provider); |
29 | 29 |
30 ~RemoteChannelMain() override; | 30 ~RemoteChannelMain() override; |
31 | 31 |
32 // ChannelMain implementation | 32 // ChannelMain implementation |
33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, | 33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, |
34 TopControlsState current, | 34 TopControlsState current, |
35 bool animate) override; | 35 bool animate) override; |
(...skipping 11 matching lines...) Expand all Loading... |
47 void SetNeedsCommitOnImpl() override; | 47 void SetNeedsCommitOnImpl() override; |
48 void BeginMainFrameAbortedOnImpl( | 48 void BeginMainFrameAbortedOnImpl( |
49 CommitEarlyOutReason reason, | 49 CommitEarlyOutReason reason, |
50 base::TimeTicks main_thread_start_time) override; | 50 base::TimeTicks main_thread_start_time) override; |
51 void StartCommitOnImpl(CompletionEvent* completion, | 51 void StartCommitOnImpl(CompletionEvent* completion, |
52 LayerTreeHost* layer_tree_host, | 52 LayerTreeHost* layer_tree_host, |
53 base::TimeTicks main_thread_start_time, | 53 base::TimeTicks main_thread_start_time, |
54 bool hold_commit_for_activation) override; | 54 bool hold_commit_for_activation) override; |
55 void SynchronouslyInitializeImpl( | 55 void SynchronouslyInitializeImpl( |
56 LayerTreeHost* layer_tree_host, | 56 LayerTreeHost* layer_tree_host, |
57 scoped_ptr<BeginFrameSource> external_begin_frame_source) override; | 57 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; |
58 void SynchronouslyCloseImpl() override; | 58 void SynchronouslyCloseImpl() override; |
59 | 59 |
60 // RemoteProtoChannel::ProtoReceiver implementation | 60 // RemoteProtoChannel::ProtoReceiver implementation |
61 void OnProtoReceived(scoped_ptr<proto::CompositorMessage> proto) override; | 61 void OnProtoReceived( |
| 62 std::unique_ptr<proto::CompositorMessage> proto) override; |
62 | 63 |
63 protected: | 64 protected: |
64 RemoteChannelMain(RemoteProtoChannel* remote_proto_channel, | 65 RemoteChannelMain(RemoteProtoChannel* remote_proto_channel, |
65 ProxyMain* proxy_main, | 66 ProxyMain* proxy_main, |
66 TaskRunnerProvider* task_runner_provider); | 67 TaskRunnerProvider* task_runner_provider); |
67 | 68 |
68 private: | 69 private: |
69 void SendMessageProto(const proto::CompositorMessage& proto); | 70 void SendMessageProto(const proto::CompositorMessage& proto); |
70 void HandleProto(const proto::CompositorMessageToMain& proto); | 71 void HandleProto(const proto::CompositorMessageToMain& proto); |
71 void DidCommitAndDrawFrame(); | 72 void DidCommitAndDrawFrame(); |
72 void DidCompleteSwapBuffers(); | 73 void DidCompleteSwapBuffers(); |
73 | 74 |
74 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | 75 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
75 | 76 |
76 RemoteProtoChannel* remote_proto_channel_; | 77 RemoteProtoChannel* remote_proto_channel_; |
77 ProxyMain* proxy_main_; | 78 ProxyMain* proxy_main_; |
78 TaskRunnerProvider* task_runner_provider_; | 79 TaskRunnerProvider* task_runner_provider_; |
79 | 80 |
80 bool initialized_; | 81 bool initialized_; |
81 | 82 |
82 base::WeakPtrFactory<RemoteChannelMain> weak_factory_; | 83 base::WeakPtrFactory<RemoteChannelMain> weak_factory_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(RemoteChannelMain); | 85 DISALLOW_COPY_AND_ASSIGN(RemoteChannelMain); |
85 }; | 86 }; |
86 | 87 |
87 } // namespace cc | 88 } // namespace cc |
88 | 89 |
89 #endif // CC_TREES_REMOTE_CHANNEL_MAIN_H_ | 90 #endif // CC_TREES_REMOTE_CHANNEL_MAIN_H_ |
OLD | NEW |