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

Side by Side Diff: services/ui/ws/server_window_surface_manager.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
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_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ 6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "cc/ipc/compositor_frame.mojom.h" 11 #include "cc/ipc/compositor_frame.mojom.h"
12 #include "cc/surfaces/surface_factory.h" 12 #include "cc/surfaces/surface_factory.h"
13 #include "cc/surfaces/surface_id.h" 13 #include "cc/surfaces/surface_id.h"
14 #include "cc/surfaces/surface_sequence_generator.h"
14 #include "mojo/public/cpp/bindings/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/ui/public/interfaces/window_tree.mojom.h" 16 #include "services/ui/public/interfaces/window_tree.mojom.h"
16 17
17 namespace ui { 18 namespace ui {
18 namespace ws { 19 namespace ws {
19 20
20 class ServerWindow; 21 class ServerWindow;
21 class ServerWindowSurface; 22 class ServerWindowSurface;
22 class ServerWindowSurfaceManagerTestApi; 23 class ServerWindowSurfaceManagerTestApi;
23 24
24 // ServerWindowSurfaceManager tracks the surfaces associated with a 25 // ServerWindowSurfaceManager tracks the surfaces associated with a
25 // ServerWindow. 26 // ServerWindow.
26 class ServerWindowSurfaceManager { 27 class ServerWindowSurfaceManager {
27 public: 28 public:
28 explicit ServerWindowSurfaceManager(ServerWindow* window); 29 explicit ServerWindowSurfaceManager(ServerWindow* window);
29 ~ServerWindowSurfaceManager(); 30 ~ServerWindowSurfaceManager();
30 31
31 // Returns true if the surfaces from this manager should be drawn. 32 // Returns true if the surfaces from this manager should be drawn.
32 bool ShouldDraw(); 33 bool ShouldDraw();
33 34
34 // Creates a new surface of the specified type, replacing the existing one of 35 // Creates a new surface of the specified type, replacing the existing one of
35 // the specified type. 36 // the specified type.
36 void CreateSurface(mojom::SurfaceType surface_type, 37 void CreateSurface(mojom::SurfaceType surface_type,
37 mojo::InterfaceRequest<mojom::Surface> request, 38 mojo::InterfaceRequest<mojom::Surface> request,
38 mojom::SurfaceClientPtr client); 39 mojom::SurfaceClientPtr client);
39 40
41 // TODO(fsamuel): This is temporary until we replace SurfaceSequences with
42 // refcounting.
43 cc::SurfaceSequence CreateSurfaceSequence();
44
45 void SatisfySurfaceSequence(const cc::SurfaceSequence& sequence);
46
40 ServerWindow* window() { return window_; } 47 ServerWindow* window() { return window_; }
41 48
42 ServerWindowSurface* GetDefaultSurface() const; 49 ServerWindowSurface* GetDefaultSurface() const;
43 ServerWindowSurface* GetUnderlaySurface() const; 50 ServerWindowSurface* GetUnderlaySurface() const;
44 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const; 51 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const;
45 bool HasSurfaceOfType(mojom::SurfaceType type) const; 52 bool HasSurfaceOfType(mojom::SurfaceType type) const;
46 bool HasAnySurface() const; 53 bool HasAnySurface() const;
47 54
48 cc::SurfaceManager* GetSurfaceManager(); 55 cc::SurfaceManager* GetSurfaceManager();
49 56
50 private: 57 private:
51 friend class ServerWindowSurfaceManagerTestApi; 58 friend class ServerWindowSurfaceManagerTestApi;
52 friend class ServerWindowSurface; 59 friend class ServerWindowSurface;
53 60
54 // Returns true if a surface of |type| has been set and its size is greater 61 // Returns true if a surface of |type| has been set and its size is greater
55 // than the size of the window. 62 // than the size of the window.
56 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const; 63 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const;
57 64
58 ServerWindow* window_; 65 ServerWindow* window_;
66 cc::FrameSinkId frame_sink_id_;
67 cc::SurfaceSequenceGenerator surface_sequence_generator_;
59 68
60 using TypeToSurfaceMap = 69 using TypeToSurfaceMap =
61 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>; 70 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>;
62 71
63 TypeToSurfaceMap type_to_surface_map_; 72 TypeToSurfaceMap type_to_surface_map_;
64 73
65 // While true the window is not drawn. This is initially true if the window 74 // While true the window is not drawn. This is initially true if the window
66 // has the property |kWaitForUnderlay_Property|. This is set to false once 75 // has the property |kWaitForUnderlay_Property|. This is set to false once
67 // the underlay and default surface have been set *and* their size is at 76 // the underlay and default surface have been set *and* their size is at
68 // least that of the window. Ideally we would wait for sizes to match, but 77 // least that of the window. Ideally we would wait for sizes to match, but
69 // the underlay is not necessarily as big as the window. 78 // the underlay is not necessarily as big as the window.
70 bool waiting_for_initial_frames_; 79 bool waiting_for_initial_frames_;
71 80
72 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); 81 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager);
73 }; 82 };
74 83
75 } // namespace ws 84 } // namespace ws
76 } // namespace ui 85 } // namespace ui
77 86
78 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ 87 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/ws/server_window_surface.cc ('k') | services/ui/ws/server_window_surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698