| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/server_view.h" | 5 #include "components/mus/server_view.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/mus/server_view_delegate.h" | 10 #include "components/mus/server_view_delegate.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void ServerView::SubmitCompositorFrame( | 249 void ServerView::SubmitCompositorFrame( |
| 250 mojo::CompositorFramePtr frame, | 250 mojo::CompositorFramePtr frame, |
| 251 const SubmitCompositorFrameCallback& callback) { | 251 const SubmitCompositorFrameCallback& callback) { |
| 252 gfx::Size frame_size = frame->passes[0]->output_rect.To<gfx::Rect>().size(); | 252 gfx::Size frame_size = frame->passes[0]->output_rect.To<gfx::Rect>().size(); |
| 253 // Create Surfaces state on demand. | 253 // Create Surfaces state on demand. |
| 254 if (!surface_factory_) { | 254 if (!surface_factory_) { |
| 255 surface_factory_.reset( | 255 surface_factory_.reset( |
| 256 new cc::SurfaceFactory(delegate_->GetSurfacesState()->manager(), this)); | 256 new cc::SurfaceFactory(delegate_->GetSurfacesState()->manager(), this)); |
| 257 } | 257 } |
| 258 if (!surface_id_allocator_) { | 258 if (!surface_id_allocator_) { |
| 259 surface_id_allocator_.reset(new cc::SurfaceIdAllocator( | 259 surface_id_allocator_.reset( |
| 260 delegate_->GetSurfacesState()->next_id_namespace())); | 260 new cc::SurfaceIdAllocator(ViewIdToTransportId(id()))); |
| 261 } | 261 } |
| 262 if (surface_id().is_null()) { | 262 if (surface_id().is_null()) { |
| 263 // Create a Surface ID for the first time for this view. | 263 // Create a Surface ID for the first time for this view. |
| 264 cc::SurfaceId surface_id(surface_id_allocator_->GenerateId()); | 264 cc::SurfaceId surface_id(surface_id_allocator_->GenerateId()); |
| 265 surface_factory_->Create(surface_id); | 265 surface_factory_->Create(surface_id); |
| 266 SetSurfaceId(surface_id); | 266 SetSurfaceId(surface_id); |
| 267 } else { | 267 } else { |
| 268 // If the size of the CompostiorFrame has changed then destroy the existing | 268 // If the size of the CompostiorFrame has changed then destroy the existing |
| 269 // Surface and create a new one of the appropriate size. | 269 // Surface and create a new one of the appropriate size. |
| 270 if (frame_size != last_submitted_frame_size()) { | 270 if (frame_size != last_submitted_frame_size()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 client_->ReturnResources( | 306 client_->ReturnResources( |
| 307 mojo::Array<mojo::ReturnedResourcePtr>::From(resources)); | 307 mojo::Array<mojo::ReturnedResourcePtr>::From(resources)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 void ServerView::RemoveImpl(ServerView* view) { | 310 void ServerView::RemoveImpl(ServerView* view) { |
| 311 view->parent_ = NULL; | 311 view->parent_ = NULL; |
| 312 children_.erase(std::find(children_.begin(), children_.end(), view)); | 312 children_.erase(std::find(children_.begin(), children_.end(), view)); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace view_manager | 315 } // namespace view_manager |
| OLD | NEW |