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 SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
6 #define SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 6 #define SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include "cc/surfaces/display_client.h" | 8 #include "cc/surfaces/display_client.h" |
9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // CompositorFrameSink embedders submit a CompositorFrame when content on the | 42 // CompositorFrameSink embedders submit a CompositorFrame when content on the |
43 // display should be changed. A well-behaving embedder should only submit | 43 // display should be changed. A well-behaving embedder should only submit |
44 // a CompositorFrame once per BeginFrame tick. The callback is called the | 44 // a CompositorFrame once per BeginFrame tick. The callback is called the |
45 // first time this frame is used to draw, or if the frame is discarded. | 45 // first time this frame is used to draw, or if the frame is discarded. |
46 void SubmitCompositorFrame(cc::CompositorFrame frame, | 46 void SubmitCompositorFrame(cc::CompositorFrame frame, |
47 const base::Callback<void()>& callback); | 47 const base::Callback<void()>& callback); |
48 | 48 |
49 // TODO(fsamuel): This is used for surface hittesting and should not be | 49 // TODO(fsamuel): This is used for surface hittesting and should not be |
50 // exposed outside of CompositorFrameSink. | 50 // exposed outside of CompositorFrameSink. |
51 const cc::SurfaceId& surface_id() const { return surface_id_; } | 51 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; } |
52 | 52 |
53 // This requests the display CompositorFrame be rendered and given to the | 53 // This requests the display CompositorFrame be rendered and given to the |
54 // callback within CopyOutputRequest. | 54 // callback within CopyOutputRequest. |
55 void RequestCopyOfOutput( | 55 void RequestCopyOfOutput( |
56 std::unique_ptr<cc::CopyOutputRequest> output_request); | 56 std::unique_ptr<cc::CopyOutputRequest> output_request); |
57 | 57 |
58 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace | 58 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace |
59 // A SurfaceNamespace can create CompositorFrameSinks where the client can | 59 // A SurfaceNamespace can create CompositorFrameSinks where the client can |
60 // make up the ID. | 60 // make up the ID. |
61 | 61 |
62 private: | 62 private: |
63 // SurfaceFactoryClient implementation. | 63 // SurfaceFactoryClient implementation. |
64 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 64 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
65 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 65 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
66 | 66 |
67 // DisplayClient implementation. | 67 // DisplayClient implementation. |
68 void DisplayOutputSurfaceLost() override; | 68 void DisplayOutputSurfaceLost() override; |
69 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | 69 void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
70 const cc::RenderPassList& render_passes) override; | 70 const cc::RenderPassList& render_passes) override; |
71 void DisplayDidDrawAndSwap() override; | 71 void DisplayDidDrawAndSwap() override; |
72 | 72 |
73 const cc::FrameSinkId frame_sink_id_; | 73 const cc::FrameSinkId frame_sink_id_; |
74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
75 scoped_refptr<DisplayCompositor> display_compositor_; | 75 scoped_refptr<DisplayCompositor> display_compositor_; |
76 cc::SurfaceFactory factory_; | 76 cc::SurfaceFactory factory_; |
77 cc::SurfaceIdAllocator allocator_; | 77 cc::SurfaceIdAllocator allocator_; |
78 cc::SurfaceId surface_id_; | 78 cc::LocalFrameId local_frame_id_; |
79 | 79 |
80 gfx::Size display_size_; | 80 gfx::Size display_size_; |
81 std::unique_ptr<cc::Display> display_; | 81 std::unique_ptr<cc::Display> display_; |
82 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); | 82 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); |
83 }; | 83 }; |
84 | 84 |
85 } // nanmespace surfaces | 85 } // nanmespace surfaces |
86 } // namespace ui | 86 } // namespace ui |
87 | 87 |
88 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 88 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |