Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: services/ui/surfaces/compositor_frame_sink.h

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/surfaces/BUILD.gn ('k') | services/ui/surfaces/compositor_frame_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DISPLAY_COMPOSITOR_H_ 5 #ifndef SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_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"
11 #include "cc/surfaces/surface_factory_client.h" 11 #include "cc/surfaces/surface_factory_client.h"
12 #include "cc/surfaces/surface_id_allocator.h" 12 #include "cc/surfaces/surface_id_allocator.h"
13 #include "services/ui/surfaces/surfaces_state.h" 13 #include "services/ui/surfaces/display_compositor.h"
14 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
15 15
16 namespace cc { 16 namespace cc {
17 class Display; 17 class Display;
18 } 18 }
19 19
20 namespace gpu { 20 namespace gpu {
21 class GpuChannelHost; 21 class GpuChannelHost;
22 } 22 }
23 23
24 namespace ui { 24 namespace ui {
25 namespace surfaces {
25 26
26 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. 27 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
27 // TODO(fsamuel): This should not be a SurfaceFactoryClient. 28 // TODO(fsamuel): This should not be a SurfaceFactoryClient.
28 // The DisplayCompositor receives CompositorFrames from all sources, 29 // The CompositorFrameSink receives CompositorFrames from all sources,
29 // creates a top-level CompositorFrame once per tick, and generates graphical 30 // creates a top-level CompositorFrame once per tick, and generates graphical
30 // output. 31 // output.
31 class DisplayCompositor : public cc::SurfaceFactoryClient, 32 class CompositorFrameSink : public cc::SurfaceFactoryClient,
32 public cc::DisplayClient { 33 public cc::DisplayClient {
33 public: 34 public:
34 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 35 CompositorFrameSink(
35 gfx::AcceleratedWidget widget, 36 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
36 scoped_refptr<gpu::GpuChannelHost> gpu_channel, 37 gfx::AcceleratedWidget widget,
37 const scoped_refptr<SurfacesState>& surfaces_state); 38 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
38 ~DisplayCompositor() override; 39 const scoped_refptr<DisplayCompositor>& display_compositor);
40 ~CompositorFrameSink() override;
39 41
40 // DisplayCompositor embedders submit a CompositorFrame when content on the 42 // CompositorFrameSink embedders submit a CompositorFrame when content on the
41 // display should be changed. A well-behaving embedder should only submit 43 // display should be changed. A well-behaving embedder should only submit
42 // a CompositorFrame once per BeginFrame tick. The callback is called the 44 // a CompositorFrame once per BeginFrame tick. The callback is called the
43 // 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.
44 void SubmitCompositorFrame(cc::CompositorFrame frame, 46 void SubmitCompositorFrame(cc::CompositorFrame frame,
45 const base::Callback<void()>& callback); 47 const base::Callback<void()>& callback);
46 48
47 // 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
48 // exposed outside of DisplayCompositor. 50 // exposed outside of CompositorFrameSink.
49 const cc::SurfaceId& surface_id() const { return surface_id_; } 51 const cc::SurfaceId& surface_id() const { return surface_id_; }
50 52
51 // This requests the display CompositorFrame be rendered and given to the 53 // This requests the display CompositorFrame be rendered and given to the
52 // callback within CopyOutputRequest. 54 // callback within CopyOutputRequest.
53 void RequestCopyOfOutput( 55 void RequestCopyOfOutput(
54 std::unique_ptr<cc::CopyOutputRequest> output_request); 56 std::unique_ptr<cc::CopyOutputRequest> output_request);
55 57
56 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace 58 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace
57 // A SurfaceNamespace can create CompositorFrameSinks where the client can 59 // A SurfaceNamespace can create CompositorFrameSinks where the client can
58 // make up the ID. 60 // make up the ID.
59 61
60 private: 62 private:
61 // SurfaceFactoryClient implementation. 63 // SurfaceFactoryClient implementation.
62 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 64 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
63 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; 65 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
64 66
65 // DisplayClient implementation. 67 // DisplayClient implementation.
66 void DisplayOutputSurfaceLost() override; 68 void DisplayOutputSurfaceLost() override;
67 void DisplayWillDrawAndSwap(bool will_draw_and_swap, 69 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
68 const cc::RenderPassList& render_passes) override; 70 const cc::RenderPassList& render_passes) override;
69 void DisplayDidDrawAndSwap() override; 71 void DisplayDidDrawAndSwap() override;
70 72
71 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
72 scoped_refptr<SurfacesState> surfaces_state_; 74 scoped_refptr<DisplayCompositor> display_compositor_;
73 cc::SurfaceFactory factory_; 75 cc::SurfaceFactory factory_;
74 cc::SurfaceIdAllocator allocator_; 76 cc::SurfaceIdAllocator allocator_;
75 cc::SurfaceId surface_id_; 77 cc::SurfaceId surface_id_;
76 78
77 gfx::Size display_size_; 79 gfx::Size display_size_;
78 std::unique_ptr<cc::Display> display_; 80 std::unique_ptr<cc::Display> display_;
79 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 81 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink);
80 }; 82 };
81 83
84 } // nanmespace surfaces
82 } // namespace ui 85 } // namespace ui
83 86
84 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 87 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « services/ui/surfaces/BUILD.gn ('k') | services/ui/surfaces/compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698