| OLD | NEW |
| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // CompositorFrameSinks. | 276 // CompositorFrameSinks. |
| 277 DCHECK_NE(WindowMusType::TOP_LEVEL_IN_WM, window_mus_type()); | 277 DCHECK_NE(WindowMusType::TOP_LEVEL_IN_WM, window_mus_type()); |
| 278 DCHECK_NE(WindowMusType::EMBED_IN_OWNER, window_mus_type()); | 278 DCHECK_NE(WindowMusType::EMBED_IN_OWNER, window_mus_type()); |
| 279 base::ResetAndReturn(&pending_compositor_frame_sink_request_).Run(); | 279 base::ResetAndReturn(&pending_compositor_frame_sink_request_).Run(); |
| 280 } | 280 } |
| 281 // TODO(fsamuel): If the window type is TOP_LEVEL_IN_WM or EMBED_IN_OWNER then | 281 // TODO(fsamuel): If the window type is TOP_LEVEL_IN_WM or EMBED_IN_OWNER then |
| 282 // we should check if we have a cc::LocalSurfaeId ready as well. If we do, | 282 // we should check if we have a cc::LocalSurfaeId ready as well. If we do, |
| 283 // then we are ready to embed. | 283 // then we are ready to embed. |
| 284 } | 284 } |
| 285 | 285 |
| 286 const cc::LocalSurfaceId& WindowPortMus::GetLocalSurfaceId() { |
| 287 return local_surface_id_; |
| 288 } |
| 289 |
| 290 const cc::LocalSurfaceId& WindowPortMus::GetOrAllocateLocalSurfaceId( |
| 291 const gfx::Size& surface_size) { |
| 292 if (last_surface_size_ == surface_size && local_surface_id_.is_valid()) |
| 293 return local_surface_id_; |
| 294 |
| 295 local_surface_id_ = local_surface_id_allocator_.GenerateId(); |
| 296 last_surface_size_ = surface_size; |
| 297 |
| 298 // TODO(fsamuel): If surface synchronization is enabled and the FrameSinkId |
| 299 // is available, then immediately embed the SurfaceId. The newly generated |
| 300 // frame by the embedder will block in the display compositor until the |
| 301 // child submits a corresponding CompositorFrame or a deadline hits. |
| 302 |
| 303 return local_surface_id_; |
| 304 } |
| 305 |
| 286 void WindowPortMus::SetSurfaceInfoFromServer( | 306 void WindowPortMus::SetSurfaceInfoFromServer( |
| 287 const cc::SurfaceInfo& surface_info) { | 307 const cc::SurfaceInfo& surface_info) { |
| 288 if (surface_info_.is_valid()) { | 308 if (surface_info_.is_valid()) { |
| 289 const cc::SurfaceId& existing_surface_id = surface_info_.id(); | 309 const cc::SurfaceId& existing_surface_id = surface_info_.id(); |
| 290 const cc::SurfaceId& new_surface_id = surface_info.id(); | 310 const cc::SurfaceId& new_surface_id = surface_info.id(); |
| 291 if (existing_surface_id.is_valid() && | 311 if (existing_surface_id.is_valid() && |
| 292 existing_surface_id != new_surface_id) { | 312 existing_surface_id != new_surface_id) { |
| 293 // TODO(kylechar): Start return reference here? | 313 // TODO(kylechar): Start return reference here? |
| 294 } | 314 } |
| 295 } | 315 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 502 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
| 483 // TODO(sky): investigate to see if we need to compare data. In particular do | 503 // TODO(sky): investigate to see if we need to compare data. In particular do |
| 484 // we ever have a case where changing a property cascades into changing the | 504 // we ever have a case where changing a property cascades into changing the |
| 485 // same property? | 505 // same property? |
| 486 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 506 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
| 487 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, | 507 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, |
| 488 std::move(data)); | 508 std::move(data)); |
| 489 } | 509 } |
| 490 | 510 |
| 491 } // namespace aura | 511 } // namespace aura |
| OLD | NEW |