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 "mojo/services/view_manager/display_manager.h" | 5 #include "mojo/services/view_manager/display_manager.h" |
6 | 6 |
7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 frame->passes.push_back(pass.Pass()); | 149 frame->passes.push_back(pass.Pass()); |
150 frame->resources.resize(0u); | 150 frame->resources.resize(0u); |
151 surface_->SubmitFrame(SurfaceId::From(surface_id_), frame.Pass()); | 151 surface_->SubmitFrame(SurfaceId::From(surface_id_), frame.Pass()); |
152 | 152 |
153 native_viewport_->SubmittedFrame(SurfaceId::From(surface_id_)); | 153 native_viewport_->SubmittedFrame(SurfaceId::From(surface_id_)); |
154 | 154 |
155 dirty_rect_ = gfx::Rect(); | 155 dirty_rect_ = gfx::Rect(); |
156 } | 156 } |
157 | 157 |
158 void DisplayManager::OnDestroyed() { | 158 void DisplayManager::OnDestroyed() { |
| 159 // This is called when the native_viewport is torn down before |
| 160 // ~DisplayManager may be called. |
159 native_viewport_closed_callback_.Run(); | 161 native_viewport_closed_callback_.Run(); |
160 } | 162 } |
161 | 163 |
162 void DisplayManager::OnSizeChanged(SizePtr size) { | 164 void DisplayManager::OnSizeChanged(SizePtr size) { |
163 size_ = size.To<gfx::Size>(); | 165 size_ = size.To<gfx::Size>(); |
164 connection_manager_->root()->SetBounds(gfx::Rect(size_)); | 166 connection_manager_->root()->SetBounds(gfx::Rect(size_)); |
165 if (surface_id_.is_null()) | 167 if (surface_id_.is_null()) |
166 return; | 168 return; |
167 surface_->DestroySurface(SurfaceId::From(surface_id_)); | 169 surface_->DestroySurface(SurfaceId::From(surface_id_)); |
168 surface_id_ = cc::SurfaceId(); | 170 surface_id_ = cc::SurfaceId(); |
169 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); | 171 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); |
170 } | 172 } |
171 | 173 |
172 void DisplayManager::ReturnResources(Array<ReturnedResourcePtr> resources) { | 174 void DisplayManager::ReturnResources(Array<ReturnedResourcePtr> resources) { |
173 DCHECK_EQ(0u, resources.size()); | 175 DCHECK_EQ(0u, resources.size()); |
174 } | 176 } |
175 | 177 |
176 } // namespace service | 178 } // namespace service |
177 } // namespace mojo | 179 } // namespace mojo |
OLD | NEW |