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