| 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 BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ | 5 #ifndef BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ |
| 6 #define BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ | 6 #define BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "blimp/engine/renderer/frame_scheduler.h" | 10 #include "blimp/engine/renderer/frame_scheduler.h" |
| 11 #include "cc/blimp/remote_compositor_bridge.h" | 11 #include "cc/blimp/remote_compositor_bridge.h" |
| 12 #include "cc/trees/remote_proto_channel.h" | 12 #include "content/public/renderer/remote_proto_channel.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 namespace engine { | 15 namespace engine { |
| 16 | 16 |
| 17 class BlimpRemoteCompositorBridge | 17 class BlimpRemoteCompositorBridge |
| 18 : public cc::RemoteCompositorBridge, | 18 : public cc::RemoteCompositorBridge, |
| 19 public cc::RemoteProtoChannel::ProtoReceiver, | 19 public content::RemoteProtoChannel::ProtoReceiver, |
| 20 public FrameSchedulerClient { | 20 public FrameSchedulerClient { |
| 21 public: | 21 public: |
| 22 // TODO(khushalsagar): Stop using the RemoteProtoChannel. See | 22 // TODO(khushalsagar): Stop using the RemoteProtoChannel. See |
| 23 // crbug.com/653697. | 23 // crbug.com/653697. |
| 24 // |remote_proto_channel| should outlive the BlimpRemoteCompositorBridge. | 24 // |remote_proto_channel| should outlive the BlimpRemoteCompositorBridge. |
| 25 BlimpRemoteCompositorBridge( | 25 BlimpRemoteCompositorBridge( |
| 26 cc::RemoteProtoChannel* remote_proto_channel, | 26 content::RemoteProtoChannel* remote_proto_channel, |
| 27 scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner); | 27 scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner); |
| 28 ~BlimpRemoteCompositorBridge() override; | 28 ~BlimpRemoteCompositorBridge() override; |
| 29 | 29 |
| 30 // cc::RemoteCompositorBridge implementation. | 30 // cc::RemoteCompositorBridge implementation. |
| 31 void BindToClient(cc::RemoteCompositorBridgeClient* client) override; | 31 void BindToClient(cc::RemoteCompositorBridgeClient* client) override; |
| 32 void ScheduleMainFrame() override; | 32 void ScheduleMainFrame() override; |
| 33 void ProcessCompositorStateUpdate(std::unique_ptr<cc::CompositorProtoState> | 33 void ProcessCompositorStateUpdate(std::unique_ptr<cc::CompositorProtoState> |
| 34 compositor_proto_state) override; | 34 compositor_proto_state) override; |
| 35 | 35 |
| 36 FrameScheduler* scheduler_for_testing() { return &scheduler_; } | 36 FrameScheduler* scheduler_for_testing() { return &scheduler_; } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // cc::RemoteProtoChannel::ProtoReceiver implementation. | 39 // content::RemoteProtoChannel::ProtoReceiver implementation. |
| 40 void OnProtoReceived( | 40 void OnProtoReceived( |
| 41 std::unique_ptr<cc::proto::CompositorMessage> proto) override; | 41 std::unique_ptr<cc::proto::CompositorMessage> proto) override; |
| 42 | 42 |
| 43 // FrameSchedulerClient implementation. | 43 // FrameSchedulerClient implementation. |
| 44 void StartFrameUpdate() override; | 44 void StartFrameUpdate() override; |
| 45 | 45 |
| 46 cc::RemoteProtoChannel* remote_proto_channel_; | 46 content::RemoteProtoChannel* remote_proto_channel_; |
| 47 cc::RemoteCompositorBridgeClient* client_ = nullptr; | 47 cc::RemoteCompositorBridgeClient* client_ = nullptr; |
| 48 | 48 |
| 49 bool client_state_update_ack_pending_ = false; | 49 bool client_state_update_ack_pending_ = false; |
| 50 | 50 |
| 51 FrameScheduler scheduler_; | 51 FrameScheduler scheduler_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(BlimpRemoteCompositorBridge); | 53 DISALLOW_COPY_AND_ASSIGN(BlimpRemoteCompositorBridge); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace engine | 56 } // namespace engine |
| 57 } // namespace blimp | 57 } // namespace blimp |
| 58 | 58 |
| 59 #endif // BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ | 59 #endif // BLIMP_ENGINE_RENDERER_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_ |
| OLD | NEW |