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

Side by Side Diff: ui/aura/mus/window_port_mus.cc

Issue 2886873002: Only send the FrameSinkId to client when it is necessary (Closed)
Patch Set: Address review issues. Created 3 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
« no previous file with comments | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('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 #include "ui/aura/mus/window_port_mus.h" 5 #include "ui/aura/mus/window_port_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/transient_window_client.h" 9 #include "ui/aura/client/transient_window_client.h"
10 #include "ui/aura/mus/client_surface_embedder.h" 10 #include "ui/aura/mus/client_surface_embedder.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 window_tree_client_->SetCanAcceptDrops(this, can_accept_drops); 86 window_tree_client_->SetCanAcceptDrops(this, can_accept_drops);
87 } 87 }
88 88
89 void WindowPortMus::Embed( 89 void WindowPortMus::Embed(
90 ui::mojom::WindowTreeClientPtr client, 90 ui::mojom::WindowTreeClientPtr client,
91 uint32_t flags, 91 uint32_t flags,
92 const ui::mojom::WindowTree::EmbedCallback& callback) { 92 const ui::mojom::WindowTree::EmbedCallback& callback) {
93 window_tree_client_->Embed(window_, std::move(client), flags, callback); 93 window_tree_client_->Embed(window_, std::move(client), flags, callback);
94 } 94 }
95 95
96 void WindowPortMus::RequestCompositorFrameSink( 96 std::unique_ptr<cc::CompositorFrameSink>
97 WindowPortMus::RequestCompositorFrameSink(
97 scoped_refptr<cc::ContextProvider> context_provider, 98 scoped_refptr<cc::ContextProvider> context_provider,
98 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 99 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
99 const CompositorFrameSinkCallback& callback) {
100 DCHECK(pending_compositor_frame_sink_request_.is_null());
101 // If we haven't received a FrameSinkId from the window server yet then we
102 // bind the parameters to a closure that will be called once the FrameSinkId
103 // is available.
104 if (!frame_sink_id_.is_valid()) {
105 pending_compositor_frame_sink_request_ =
106 base::Bind(&WindowPortMus::RequestCompositorFrameSinkInternal,
107 base::Unretained(this), std::move(context_provider),
108 gpu_memory_buffer_manager, callback);
109 return;
110 }
111
112 RequestCompositorFrameSinkInternal(std::move(context_provider),
113 gpu_memory_buffer_manager, callback);
114 }
115
116 void WindowPortMus::RequestCompositorFrameSinkInternal(
117 scoped_refptr<cc::ContextProvider> context_provider,
118 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
119 const CompositorFrameSinkCallback& callback) {
120 DCHECK(frame_sink_id_.is_valid());
121 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> 100 std::unique_ptr<ui::ClientCompositorFrameSinkBinding>
122 compositor_frame_sink_binding; 101 compositor_frame_sink_binding;
123 std::unique_ptr<ui::ClientCompositorFrameSink> compositor_frame_sink = 102 std::unique_ptr<ui::ClientCompositorFrameSink> compositor_frame_sink =
124 ui::ClientCompositorFrameSink::Create( 103 ui::ClientCompositorFrameSink::Create(
125 frame_sink_id_, std::move(context_provider), 104 std::move(context_provider), gpu_memory_buffer_manager,
126 gpu_memory_buffer_manager, &compositor_frame_sink_binding); 105 &compositor_frame_sink_binding,
106 window_tree_client_->enable_surface_synchronization_);
127 AttachCompositorFrameSink(std::move(compositor_frame_sink_binding)); 107 AttachCompositorFrameSink(std::move(compositor_frame_sink_binding));
128 callback.Run(std::move(compositor_frame_sink)); 108 return std::move(compositor_frame_sink);
129 } 109 }
130 110
131 void WindowPortMus::AttachCompositorFrameSink( 111 void WindowPortMus::AttachCompositorFrameSink(
132 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> 112 std::unique_ptr<ui::ClientCompositorFrameSinkBinding>
133 compositor_frame_sink_binding) { 113 compositor_frame_sink_binding) {
134 window_tree_client_->AttachCompositorFrameSink( 114 window_tree_client_->AttachCompositorFrameSink(
135 server_id(), compositor_frame_sink_binding->TakeFrameSinkRequest(), 115 server_id(), compositor_frame_sink_binding->TakeFrameSinkRequest(),
136 mojo::MakeProxy(compositor_frame_sink_binding->TakeFrameSinkClient())); 116 mojo::MakeProxy(compositor_frame_sink_binding->TakeFrameSinkClient()));
137 } 117 }
138 118
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const std::vector<uint8_t>* property_data) { 261 const std::vector<uint8_t>* property_data) {
282 ServerChangeData data; 262 ServerChangeData data;
283 data.property_name = property_name; 263 data.property_name = property_name;
284 ScopedServerChange change(this, ServerChangeType::PROPERTY, data); 264 ScopedServerChange change(this, ServerChangeType::PROPERTY, data);
285 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name, 265 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name,
286 property_data); 266 property_data);
287 } 267 }
288 268
289 void WindowPortMus::SetFrameSinkIdFromServer( 269 void WindowPortMus::SetFrameSinkIdFromServer(
290 const cc::FrameSinkId& frame_sink_id) { 270 const cc::FrameSinkId& frame_sink_id) {
271 DCHECK(window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
272 window_mus_type() == WindowMusType::EMBED_IN_OWNER);
291 frame_sink_id_ = frame_sink_id; 273 frame_sink_id_ = frame_sink_id;
292 if (!pending_compositor_frame_sink_request_.is_null()) {
293 // TOP_LEVEL_IN_WM, and EMBED_IN_OWNER windows should not be requesting
294 // CompositorFrameSinks.
295 DCHECK_NE(WindowMusType::TOP_LEVEL_IN_WM, window_mus_type());
296 DCHECK_NE(WindowMusType::EMBED_IN_OWNER, window_mus_type());
297 base::ResetAndReturn(&pending_compositor_frame_sink_request_).Run();
298 return;
299 }
300 UpdatePrimarySurfaceInfo(); 274 UpdatePrimarySurfaceInfo();
301 } 275 }
302 276
303 const cc::LocalSurfaceId& WindowPortMus::GetOrAllocateLocalSurfaceId( 277 const cc::LocalSurfaceId& WindowPortMus::GetOrAllocateLocalSurfaceId(
304 const gfx::Size& surface_size) { 278 const gfx::Size& surface_size) {
305 if (last_surface_size_ == surface_size && local_surface_id_.is_valid()) 279 if (last_surface_size_ == surface_size && local_surface_id_.is_valid())
306 return local_surface_id_; 280 return local_surface_id_;
307 281
308 local_surface_id_ = local_surface_id_allocator_.GenerateId(); 282 local_surface_id_ = local_surface_id_allocator_.GenerateId();
309 last_surface_size_ = surface_size; 283 last_surface_size_ = surface_size;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (!client_surface_embedder_) { 528 if (!client_surface_embedder_) {
555 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( 529 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>(
556 window_, window_tree_client_->normal_client_area_insets_); 530 window_, window_tree_client_->normal_client_area_insets_);
557 } 531 }
558 532
559 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); 533 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_);
560 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); 534 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_);
561 } 535 }
562 536
563 } // namespace aura 537 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698