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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 rect.width = size_.width(); | 144 rect.width = size_.width(); |
145 rect.height = size_.height(); | 145 rect.height = size_.height(); |
146 PassPtr pass = CreateDefaultPass(1, rect); | 146 PassPtr pass = CreateDefaultPass(1, rect); |
147 pass->damage_rect = Rect::From(dirty_rect_); | 147 pass->damage_rect = Rect::From(dirty_rect_); |
148 | 148 |
149 DrawViewTree(pass.get(), connection_manager_->root(), gfx::Vector2d(), 1.0f); | 149 DrawViewTree(pass.get(), connection_manager_->root(), gfx::Vector2d(), 1.0f); |
150 | 150 |
151 FramePtr frame = Frame::New(); | 151 FramePtr frame = Frame::New(); |
152 frame->passes.push_back(pass.Pass()); | 152 frame->passes.push_back(pass.Pass()); |
153 frame->resources.resize(0u); | 153 frame->resources.resize(0u); |
154 surface_->SubmitFrame(SurfaceId::From(surface_id_), frame.Pass()); | 154 surface_->SubmitFrame(SurfaceId::From(surface_id_), frame.Pass(), |
| 155 mojo::Closure()); |
155 | 156 |
156 native_viewport_->SubmittedFrame(SurfaceId::From(surface_id_)); | 157 native_viewport_->SubmittedFrame(SurfaceId::From(surface_id_)); |
157 | 158 |
158 dirty_rect_ = gfx::Rect(); | 159 dirty_rect_ = gfx::Rect(); |
159 } | 160 } |
160 | 161 |
161 void DefaultDisplayManager::OnDestroyed() { | 162 void DefaultDisplayManager::OnDestroyed() { |
162 // This is called when the native_viewport is torn down before | 163 // This is called when the native_viewport is torn down before |
163 // ~DefaultDisplayManager may be called. | 164 // ~DefaultDisplayManager may be called. |
164 native_viewport_closed_callback_.Run(); | 165 native_viewport_closed_callback_.Run(); |
165 } | 166 } |
166 | 167 |
167 void DefaultDisplayManager::OnSizeChanged(SizePtr size) { | 168 void DefaultDisplayManager::OnSizeChanged(SizePtr size) { |
168 size_ = size.To<gfx::Size>(); | 169 size_ = size.To<gfx::Size>(); |
169 connection_manager_->root()->SetBounds(gfx::Rect(size_)); | 170 connection_manager_->root()->SetBounds(gfx::Rect(size_)); |
170 if (surface_id_.is_null()) | 171 if (surface_id_.is_null()) |
171 return; | 172 return; |
172 surface_->DestroySurface(SurfaceId::From(surface_id_)); | 173 surface_->DestroySurface(SurfaceId::From(surface_id_)); |
173 surface_id_ = cc::SurfaceId(); | 174 surface_id_ = cc::SurfaceId(); |
174 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); | 175 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); |
175 } | 176 } |
176 | 177 |
177 void DefaultDisplayManager::ReturnResources( | 178 void DefaultDisplayManager::ReturnResources( |
178 Array<ReturnedResourcePtr> resources) { | 179 Array<ReturnedResourcePtr> resources) { |
179 DCHECK_EQ(0u, resources.size()); | 180 DCHECK_EQ(0u, resources.size()); |
180 } | 181 } |
181 | 182 |
182 } // namespace service | 183 } // namespace service |
183 } // namespace mojo | 184 } // namespace mojo |
OLD | NEW |