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

Side by Side Diff: content/renderer/mus/renderer_window_tree_client.h

Issue 2764433003: mus-ws: Plumb FrameSinkId to Children (Closed)
Patch Set: Addressed Antoine's comment Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_
6 #define CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ 6 #define CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
10 #include "services/ui/common/types.h" 10 #include "services/ui/common/types.h"
11 #include "services/ui/public/interfaces/window_tree.mojom.h" 11 #include "services/ui/public/interfaces/window_tree.mojom.h"
12 12
13 namespace cc { 13 namespace cc {
14 class CompositorFrameSink; 14 class CompositorFrameSink;
15 class ContextProvider; 15 class ContextProvider;
16 } 16 }
17 17
18 namespace gpu { 18 namespace gpu {
19 class GpuMemoryBufferManager; 19 class GpuMemoryBufferManager;
20 } 20 }
21 21
22 namespace ui {
23 class ClientCompositorFrameSinkBinding;
24 }
25
26 namespace content { 22 namespace content {
27 23
28 // ui.mojom.WindowTreeClient implementation for RenderWidget. This lives and 24 // ui.mojom.WindowTreeClient implementation for RenderWidget. This lives and
29 // operates on the renderer's main thread. 25 // operates on the renderer's main thread.
30 class RendererWindowTreeClient : public ui::mojom::WindowTreeClient { 26 class RendererWindowTreeClient : public ui::mojom::WindowTreeClient {
31 public: 27 public:
32 // Creates a RendererWindowTreeClient instance for the RenderWidget instance 28 // Creates a RendererWindowTreeClient instance for the RenderWidget instance
33 // associated with |routing_id| (if one doesn't already exist). The instance 29 // associated with |routing_id| (if one doesn't already exist). The instance
34 // self-destructs when the connection to mus is lost, or when the window is 30 // self-destructs when the connection to mus is lost, or when the window is
35 // closed. 31 // closed.
36 static void CreateIfNecessary(int routing_id); 32 static void CreateIfNecessary(int routing_id);
37 33
38 // Destroys the client instance, if one exists. Otherwise, does nothing. 34 // Destroys the client instance, if one exists. Otherwise, does nothing.
39 static void Destroy(int routing_id); 35 static void Destroy(int routing_id);
40 36
41 // Returns the RendererWindowTreeClient associated with |routing_id|. Returns 37 // Returns the RendererWindowTreeClient associated with |routing_id|. Returns
42 // nullptr if none exists. 38 // nullptr if none exists.
43 static RendererWindowTreeClient* Get(int routing_id); 39 static RendererWindowTreeClient* Get(int routing_id);
44 40
45 void Bind(ui::mojom::WindowTreeClientRequest request); 41 void Bind(ui::mojom::WindowTreeClientRequest request);
46 42
47 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( 43 using CompositorFrameSinkCallback =
48 const cc::FrameSinkId& frame_sink_id, 44 base::Callback<void(std::unique_ptr<cc::CompositorFrameSink>)>;
45 void RequestCompositorFrameSink(
49 scoped_refptr<cc::ContextProvider> context_provider, 46 scoped_refptr<cc::ContextProvider> context_provider,
50 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); 47 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
48 const CompositorFrameSinkCallback& callback);
51 49
52 private: 50 private:
53 explicit RendererWindowTreeClient(int routing_id); 51 explicit RendererWindowTreeClient(int routing_id);
54 ~RendererWindowTreeClient() override; 52 ~RendererWindowTreeClient() override;
55 53
54 void RequestCompositorFrameSinkInternal(
55 scoped_refptr<cc::ContextProvider> context_provider,
56 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
57 const CompositorFrameSinkCallback& callback);
58
56 void DestroySelf(); 59 void DestroySelf();
57 60
58 // ui::mojom::WindowTreeClient: 61 // ui::mojom::WindowTreeClient:
59 // Note: A number of the following are currently not-implemented. Some of 62 // Note: A number of the following are currently not-implemented. Some of
60 // these will remain unimplemented in the long-term. Some of the 63 // these will remain unimplemented in the long-term. Some of the
61 // implementations would require some amount of refactoring out of 64 // implementations would require some amount of refactoring out of
62 // RenderWidget and related classes (e.g. resize, input, ime etc.). 65 // RenderWidget and related classes (e.g. resize, input, ime etc.).
63 void OnEmbed(ui::ClientSpecificId client_id, 66 void OnEmbed(ui::ClientSpecificId client_id,
64 ui::mojom::WindowDataPtr root, 67 ui::mojom::WindowDataPtr root,
65 ui::mojom::WindowTreePtr tree, 68 ui::mojom::WindowTreePtr tree,
66 int64_t display_id, 69 int64_t display_id,
67 ui::Id focused_window_id, 70 ui::Id focused_window_id,
68 bool drawn) override; 71 bool drawn,
72 const cc::FrameSinkId& frame_sink_id) override;
69 void OnEmbeddedAppDisconnected(ui::Id window_id) override; 73 void OnEmbeddedAppDisconnected(ui::Id window_id) override;
70 void OnUnembed(ui::Id window_id) override; 74 void OnUnembed(ui::Id window_id) override;
71 void OnCaptureChanged(ui::Id new_capture_window_id, 75 void OnCaptureChanged(ui::Id new_capture_window_id,
72 ui::Id old_capture_window_id) override; 76 ui::Id old_capture_window_id) override;
73 void OnTopLevelCreated(uint32_t change_id, 77 void OnTopLevelCreated(uint32_t change_id,
74 ui::mojom::WindowDataPtr data, 78 ui::mojom::WindowDataPtr data,
75 int64_t display_id, 79 int64_t display_id,
76 bool drawn) override; 80 bool drawn,
81 const cc::FrameSinkId& frame_sink_id) override;
77 void OnWindowBoundsChanged( 82 void OnWindowBoundsChanged(
78 ui::Id window_id, 83 ui::Id window_id,
79 const gfx::Rect& old_bounds, 84 const gfx::Rect& old_bounds,
80 const gfx::Rect& new_bounds, 85 const gfx::Rect& new_bounds,
81 const base::Optional<cc::LocalSurfaceId>& local_frame_id) override; 86 const base::Optional<cc::LocalSurfaceId>& local_frame_id) override;
82 void OnClientAreaChanged( 87 void OnClientAreaChanged(
83 uint32_t window_id, 88 uint32_t window_id,
84 const gfx::Insets& new_client_area, 89 const gfx::Insets& new_client_area,
85 const std::vector<gfx::Rect>& new_additional_client_areas) override; 90 const std::vector<gfx::Rect>& new_additional_client_areas) override;
86 void OnTransientWindowAdded(uint32_t window_id, 91 void OnTransientWindowAdded(uint32_t window_id,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 uint32_t action_taken) override; 147 uint32_t action_taken) override;
143 void OnDragDropDone() override; 148 void OnDragDropDone() override;
144 void OnChangeCompleted(uint32_t change_id, bool success) override; 149 void OnChangeCompleted(uint32_t change_id, bool success) override;
145 void RequestClose(uint32_t window_id) override; 150 void RequestClose(uint32_t window_id) override;
146 void GetWindowManager( 151 void GetWindowManager(
147 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) 152 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal)
148 override; 153 override;
149 154
150 const int routing_id_; 155 const int routing_id_;
151 ui::Id root_window_id_; 156 ui::Id root_window_id_;
157 cc::FrameSinkId frame_sink_id_;
158 scoped_refptr<cc::ContextProvider> pending_context_provider_;
159 gpu::GpuMemoryBufferManager* pending_gpu_memory_buffer_manager_ = nullptr;
160 CompositorFrameSinkCallback pending_compositor_frame_sink_callback_;
152 ui::mojom::WindowTreePtr tree_; 161 ui::mojom::WindowTreePtr tree_;
153 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> pending_frame_sink_;
154 mojo::Binding<ui::mojom::WindowTreeClient> binding_; 162 mojo::Binding<ui::mojom::WindowTreeClient> binding_;
155 163
156 DISALLOW_COPY_AND_ASSIGN(RendererWindowTreeClient); 164 DISALLOW_COPY_AND_ASSIGN(RendererWindowTreeClient);
157 }; 165 };
158 166
159 } // namespace content 167 } // namespace content
160 168
161 #endif // CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ 169 #endif // CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_mus.cc ('k') | content/renderer/mus/renderer_window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698