| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TREES_REMOTE_CHANNEL_MAIN_H_ | |
| 6 #define CC_TREES_REMOTE_CHANNEL_MAIN_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "cc/base/cc_export.h" | |
| 10 #include "cc/trees/channel_main.h" | |
| 11 #include "cc/trees/remote_proto_channel.h" | |
| 12 #include "cc/trees/task_runner_provider.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 class ProxyMain; | |
| 16 | |
| 17 namespace proto { | |
| 18 class CompositorMessage; | |
| 19 class CompositorMessageToMain; | |
| 20 } | |
| 21 | |
| 22 class CC_EXPORT RemoteChannelMain : public ChannelMain, | |
| 23 public RemoteProtoChannel::ProtoReceiver { | |
| 24 public: | |
| 25 static std::unique_ptr<RemoteChannelMain> Create( | |
| 26 RemoteProtoChannel* remote_proto_channel, | |
| 27 ProxyMain* proxy_main, | |
| 28 TaskRunnerProvider* task_runner_provider); | |
| 29 | |
| 30 ~RemoteChannelMain() override; | |
| 31 | |
| 32 // ChannelMain implementation | |
| 33 void UpdateBrowserControlsStateOnImpl(BrowserControlsState constraints, | |
| 34 BrowserControlsState current, | |
| 35 bool animate) override; | |
| 36 void InitializeCompositorFrameSinkOnImpl(CompositorFrameSink*) override; | |
| 37 void InitializeMutatorOnImpl( | |
| 38 std::unique_ptr<LayerTreeMutator> mutator) override; | |
| 39 void MainThreadHasStoppedFlingingOnImpl() override; | |
| 40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled) override; | |
| 41 void SetDeferCommitsOnImpl(bool defer_commits) override; | |
| 42 void SetVisibleOnImpl(bool visible) override; | |
| 43 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion) override; | |
| 44 void MainFrameWillHappenOnImplForTesting( | |
| 45 CompletionEvent* completion, | |
| 46 bool* main_frame_will_happen) override; | |
| 47 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) override; | |
| 48 void SetNeedsCommitOnImpl() override; | |
| 49 void BeginMainFrameAbortedOnImpl( | |
| 50 CommitEarlyOutReason reason, | |
| 51 base::TimeTicks main_thread_start_time, | |
| 52 std::vector<std::unique_ptr<SwapPromise>> swap_promises) override; | |
| 53 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, | |
| 54 LayerTreeHostInProcess* layer_tree_host, | |
| 55 base::TimeTicks main_thread_start_time, | |
| 56 bool hold_commit_for_activation) override; | |
| 57 void SynchronouslyInitializeImpl( | |
| 58 LayerTreeHostInProcess* layer_tree_host) override; | |
| 59 void SynchronouslyCloseImpl() override; | |
| 60 | |
| 61 // RemoteProtoChannel::ProtoReceiver implementation | |
| 62 void OnProtoReceived( | |
| 63 std::unique_ptr<proto::CompositorMessage> proto) override; | |
| 64 | |
| 65 protected: | |
| 66 RemoteChannelMain(RemoteProtoChannel* remote_proto_channel, | |
| 67 ProxyMain* proxy_main, | |
| 68 TaskRunnerProvider* task_runner_provider); | |
| 69 | |
| 70 private: | |
| 71 void SendMessageProto(const proto::CompositorMessage& proto); | |
| 72 void HandleProto(const proto::CompositorMessageToMain& proto); | |
| 73 void DidCommitAndDrawFrame(); | |
| 74 void DidReceiveCompositorFrameAck(); | |
| 75 | |
| 76 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | |
| 77 | |
| 78 RemoteProtoChannel* remote_proto_channel_; | |
| 79 ProxyMain* proxy_main_; | |
| 80 TaskRunnerProvider* task_runner_provider_; | |
| 81 | |
| 82 bool initialized_; | |
| 83 | |
| 84 base::WeakPtrFactory<RemoteChannelMain> weak_factory_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(RemoteChannelMain); | |
| 87 }; | |
| 88 | |
| 89 } // namespace cc | |
| 90 | |
| 91 #endif // CC_TREES_REMOTE_CHANNEL_MAIN_H_ | |
| OLD | NEW |