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

Side by Side Diff: components/mus/surfaces/display_compositor.h

Issue 1976663003: Pull parts of TopLevelDisplayClient into DisplayCompositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 4 years, 7 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
OLDNEW
(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 COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
6 #define COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
7
8 #include "cc/surfaces/surface_factory.h"
9 #include "cc/surfaces/surface_factory_client.h"
10 #include "cc/surfaces/surface_id_allocator.h"
11 #include "components/mus/gles2/gpu_state.h"
12 #include "components/mus/surfaces/surfaces_state.h"
13 #include "ui/gfx/native_widget_types.h"
14
15 namespace mus {
16
17 class TopLevelDisplayClient;
18
19 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
20 // TODO(fsamuel): This should not be a SurfaceFactoryClient.
21 // The DisplayCompositor receives CompositorFrames from all sources,
22 // creates a top-level CompositorFrame once per tick, and generates graphical
23 // output.
24 class DisplayCompositor : public cc::SurfaceFactoryClient {
25 public:
26 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
27 gfx::AcceleratedWidget widget,
28 const scoped_refptr<GpuState>& gpu_state,
29 const scoped_refptr<SurfacesState>& surfaces_state);
30 ~DisplayCompositor() override;
31
32 // DisplayCompositor embedders submits a CompositorFrame when content on the
rjkroege 2016/05/12 23:26:36 submits -> submit
Fady Samuel 2016/05/13 18:43:41 Done.
33 // display should be changed. A well-behaving embedder should only submit
34 // a CompositorFrame once per BeginFrame tick. The callback is called the
35 // first time this frame is used to draw, or if the frame is discarded.
36 void SubmitCompositorFrame(std::unique_ptr<cc::CompositorFrame> frame,
37 const base::Closure& callback);
rjkroege 2016/05/12 23:26:36 should be a DrawCallback type.
Fady Samuel 2016/05/13 18:43:41 Done.
38
39 // TODO(fsamuel): This is used for surface hittesting and should not be
40 // exposed outside of DisplayCompositor.
41 const cc::SurfaceId& surface_id() const { return surface_id_; }
42
43 void RequestCopyOfOutput(
rjkroege 2016/05/12 23:26:36 what is this for?
Fady Samuel 2016/05/13 18:43:41 This is used for taking screenshots. I added a sho
44 std::unique_ptr<cc::CopyOutputRequest> output_request);
45
46 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace
47 // A SurfaceNamespace can create CompositorFrameSinks where the client can
48 // make up the ID.
49
50 private:
51 // SurfaceFactoryClient implementation.
52 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
53 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
54
55 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
56 scoped_refptr<SurfacesState> surfaces_state_;
57 cc::SurfaceFactory factory_;
58 cc::SurfaceIdAllocator allocator_;
59 cc::SurfaceId surface_id_;
60
61 gfx::Size display_size_;
62 std::unique_ptr<TopLevelDisplayClient> display_client_;
63 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
64 };
65
66 } // namespace mus
67
68 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698