| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/ws/server_window_surface.h" | 5 #include "services/ui/ws/server_window_surface.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
| 10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 ServerWindowSurface::~ServerWindowSurface() { | 39 ServerWindowSurface::~ServerWindowSurface() { |
| 40 // SurfaceFactory's destructor will attempt to return resources which will | 40 // SurfaceFactory's destructor will attempt to return resources which will |
| 41 // call back into here and access |client_| so we should destroy | 41 // call back into here and access |client_| so we should destroy |
| 42 // |surface_factory_|'s resources early on. | 42 // |surface_factory_|'s resources early on. |
| 43 surface_factory_.DestroyAll(); | 43 surface_factory_.DestroyAll(); |
| 44 | 44 |
| 45 if (registered_surface_factory_client_) { | 45 if (registered_surface_factory_client_) { |
| 46 cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); | 46 cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); |
| 47 surface_manager->UnregisterSurfaceFactoryClient(manager_->id_namespace()); | 47 surface_manager->UnregisterSurfaceFactoryClient(manager_->client_id()); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ServerWindowSurface::SubmitCompositorFrame( | 51 void ServerWindowSurface::SubmitCompositorFrame( |
| 52 cc::CompositorFrame frame, | 52 cc::CompositorFrame frame, |
| 53 const SubmitCompositorFrameCallback& callback) { | 53 const SubmitCompositorFrameCallback& callback) { |
| 54 gfx::Size frame_size = | 54 gfx::Size frame_size = |
| 55 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); | 55 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); |
| 56 if (!surface_id_.is_null()) { | 56 if (!surface_id_.is_null()) { |
| 57 // If the size of the CompostiorFrame has changed then destroy the existing | 57 // If the size of the CompostiorFrame has changed then destroy the existing |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 std::set<cc::SurfaceId> surfaces; | 80 std::set<cc::SurfaceId> surfaces; |
| 81 surfaces.swap(surfaces_scheduled_for_destruction_); | 81 surfaces.swap(surfaces_scheduled_for_destruction_); |
| 82 for (auto& id : surfaces) | 82 for (auto& id : surfaces) |
| 83 surface_factory_.Destroy(id); | 83 surface_factory_.Destroy(id); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void ServerWindowSurface::RegisterForBeginFrames() { | 86 void ServerWindowSurface::RegisterForBeginFrames() { |
| 87 DCHECK(!registered_surface_factory_client_); | 87 DCHECK(!registered_surface_factory_client_); |
| 88 registered_surface_factory_client_ = true; | 88 registered_surface_factory_client_ = true; |
| 89 cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); | 89 cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); |
| 90 surface_manager->RegisterSurfaceFactoryClient(manager_->id_namespace(), this); | 90 surface_manager->RegisterSurfaceFactoryClient(manager_->client_id(), this); |
| 91 } | 91 } |
| 92 | 92 |
| 93 ServerWindow* ServerWindowSurface::window() { | 93 ServerWindow* ServerWindowSurface::window() { |
| 94 return manager_->window(); | 94 return manager_->window(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ServerWindowSurface::ReturnResources( | 97 void ServerWindowSurface::ReturnResources( |
| 98 const cc::ReturnedResourceArray& resources) { | 98 const cc::ReturnedResourceArray& resources) { |
| 99 if (!client_ || !base::MessageLoop::current()) | 99 if (!client_ || !base::MessageLoop::current()) |
| 100 return; | 100 return; |
| 101 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); | 101 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ServerWindowSurface::SetBeginFrameSource( | 104 void ServerWindowSurface::SetBeginFrameSource( |
| 105 cc::BeginFrameSource* begin_frame_source) { | 105 cc::BeginFrameSource* begin_frame_source) { |
| 106 // TODO(tansell): Implement this. | 106 // TODO(tansell): Implement this. |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace ws | 109 } // namespace ws |
| 110 } // namespace ui | 110 } // namespace ui |
| OLD | NEW |