| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ |
| 6 #define UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "cc/output/compositor_frame_sink.h" |
| 11 #include "cc/scheduler/begin_frame_source.h" |
| 12 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 13 #include "cc/surfaces/frame_sink_id.h" |
| 14 #include "cc/surfaces/local_surface_id_allocator.h" |
| 15 #include "ui/aura/window_port.h" |
| 16 #include "ui/base/property_data.h" |
| 17 |
| 18 namespace cc { |
| 19 class CompositorFrameSinkSupport; |
| 20 class SurfaceManager; |
| 21 } |
| 22 |
| 23 namespace aura { |
| 24 |
| 25 class CompositorFrameSinkLocal : public cc::CompositorFrameSink, |
| 26 public cc::CompositorFrameSinkSupportClient, |
| 27 public cc::ExternalBeginFrameSourceClient { |
| 28 public: |
| 29 CompositorFrameSinkLocal(const cc::FrameSinkId& frame_sink_id, |
| 30 cc::SurfaceManager* surface_manager); |
| 31 ~CompositorFrameSinkLocal() override; |
| 32 |
| 33 using SurfaceChangedCallback = |
| 34 base::Callback<void(const cc::SurfaceId&, const gfx::Size&)>; |
| 35 void SetSurfaceChangedCallback(const SurfaceChangedCallback& callback); |
| 36 |
| 37 // cc::CompositorFrameSink: |
| 38 bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
| 39 void DetachFromClient() override; |
| 40 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 41 void EvictFrame() override; |
| 42 cc::SurfaceId GetSurfaceId() const override; |
| 43 |
| 44 // cc::CompositorFrameSinkSupportClient: |
| 45 void DidReceiveCompositorFrameAck( |
| 46 const cc::ReturnedResourceArray& resources) override; |
| 47 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 48 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 49 void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, |
| 50 const gfx::Rect& damage_rect) override {} |
| 51 |
| 52 // cc::ExternalBeginFrameSourceClient: |
| 53 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
| 54 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
| 55 |
| 56 private: |
| 57 const cc::FrameSinkId frame_sink_id_; |
| 58 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 59 gfx::Size last_submitted_frame_size_; |
| 60 cc::LocalSurfaceIdAllocator id_allocator_; |
| 61 cc::LocalSurfaceId local_surface_id_; |
| 62 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 63 std::unique_ptr<base::ThreadChecker> thread_checker_; |
| 64 SurfaceChangedCallback surface_changed_callback_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkLocal); |
| 67 }; |
| 68 |
| 69 } // namespace aura |
| 70 |
| 71 #endif // UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ |
| OLD | NEW |