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

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

Issue 2489003002: Convert mustash use surface references. (Closed)
Patch Set: Created 4 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DISPLAY_COMPOSITOR_H_
6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "cc/ipc/display_compositor.mojom.h" 12 #include "cc/ipc/display_compositor.mojom.h"
13 #include "cc/surfaces/frame_sink_id.h"
13 #include "cc/surfaces/surface_manager.h" 14 #include "cc/surfaces/surface_manager.h"
14 #include "cc/surfaces/surface_observer.h" 15 #include "cc/surfaces/surface_observer.h"
15 16
16 namespace cc { 17 namespace cc {
17 class SurfaceHittest; 18 class SurfaceHittest;
18 class SurfaceManager; 19 class SurfaceManager;
19 } // namespace cc 20 } // namespace cc
20 21
21 namespace ui { 22 namespace ui {
22 23
23 class DisplayCompositorClient; 24 class DisplayCompositorClient;
24 25
25 // The DisplayCompositor object is an object global to the Window Server app 26 // The DisplayCompositor object is an object global to the Window Server app
26 // that holds the SurfaceServer and allocates new Surfaces namespaces. 27 // that holds the SurfaceServer and allocates new Surfaces namespaces.
27 // This object lives on the main thread of the Window Server. 28 // This object lives on the main thread of the Window Server.
28 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 29 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
29 // displays. 30 // displays.
30 class DisplayCompositor : public cc::SurfaceObserver, 31 class DisplayCompositor : public cc::SurfaceObserver,
31 public base::RefCounted<DisplayCompositor> { 32 public base::RefCounted<DisplayCompositor> {
32 public: 33 public:
33 explicit DisplayCompositor(cc::mojom::DisplayCompositorClientPtr client); 34 explicit DisplayCompositor(cc::mojom::DisplayCompositorClientPtr client);
34 35
35 // TODO(fsamuel): These methods should be behind a mojo interface. 36 // TODO(fsamuel): These methods should be behind a mojo interface.
36 void AddSurfaceReference(const cc::SurfaceId& surface_id, 37 void AddSurfaceReference(const cc::SurfaceId& parent_id,
37 const cc::SurfaceSequence& surface_sequence); 38 const cc::SurfaceId& child_id);
38 void ReturnSurfaceReferences(const cc::FrameSinkId& frame_sink_id, 39 void RemoveSurfaceReference(const cc::SurfaceId& parent_id,
39 const std::vector<uint32_t>& sequences); 40 const cc::SurfaceId& child_id);
40 41
41 cc::SurfaceManager* manager() { return &manager_; } 42 cc::SurfaceManager* manager() { return &manager_; }
42 43
43 private: 44 private:
44 friend class base::RefCounted<DisplayCompositor>; 45 friend class base::RefCounted<DisplayCompositor>;
45 virtual ~DisplayCompositor(); 46 virtual ~DisplayCompositor();
46 47
47 // cc::SurfaceObserver implementation. 48 // cc::SurfaceObserver implementation.
48 void OnSurfaceCreated(const cc::SurfaceId& surface_id, 49 void OnSurfaceCreated(const cc::SurfaceId& surface_id,
49 const gfx::Size& frame_size, 50 const gfx::Size& frame_size,
50 float device_scale_factor) override; 51 float device_scale_factor) override;
51 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, 52 void OnSurfaceDamaged(const cc::SurfaceId& surface_id,
52 bool* changed) override; 53 bool* changed) override;
53 54
54 cc::mojom::DisplayCompositorClientPtr client_; 55 cc::mojom::DisplayCompositorClientPtr client_;
55 cc::SurfaceManager manager_; 56 cc::SurfaceManager manager_;
56 57
58 // TODO(fsamuel): Comment on this CL and let me know what ??? below should be,
59 // DisplayCompositorHost or has the name changed?
60 // SurfaceIds that have temporary references from |kRootSurfaceId| so they
61 // aren't GC'd before ??? can add a real reference.
62 std::unordered_map<cc::FrameSinkId,
63 std::vector<cc::LocalFrameId>,
64 cc::FrameSinkIdHash>
65 temp_references_;
66
57 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 67 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
58 }; 68 };
59 69
60 } // namespace ui 70 } // namespace ui
61 71
62 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 72 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/surfaces/display_compositor.cc » ('j') | services/ui/surfaces/display_compositor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698