Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: services/view_manager/display_manager.cc

Issue 880743002: Plumb ViewportMetrics change notifications around the world and back. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix typo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "services/view_manager/display_manager.h" 5 #include "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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 native_viewport_->SubmittedFrame(qualified_id.Pass()); 166 native_viewport_->SubmittedFrame(qualified_id.Pass());
167 } 167 }
168 168
169 void DefaultDisplayManager::OnDestroyed() { 169 void DefaultDisplayManager::OnDestroyed() {
170 // This is called when the native_viewport is torn down before 170 // This is called when the native_viewport is torn down before
171 // ~DefaultDisplayManager may be called. 171 // ~DefaultDisplayManager may be called.
172 native_viewport_closed_callback_.Run(); 172 native_viewport_closed_callback_.Run();
173 } 173 }
174 174
175 void DefaultDisplayManager::OnMetricsChanged(mojo::ViewportMetricsPtr metrics) { 175 void DefaultDisplayManager::OnMetricsChanged(mojo::ViewportMetricsPtr metrics) {
176 metrics_.size = metrics->size.Pass(); 176 metrics_.size = metrics->size.Clone();
177 metrics_.device_pixel_ratio = metrics->device_pixel_ratio; 177 metrics_.device_pixel_ratio = metrics->device_pixel_ratio;
178 gfx::Rect bounds(metrics_.size.To<gfx::Size>()); 178 gfx::Rect bounds(metrics_.size.To<gfx::Size>());
179 connection_manager_->root()->SetBounds(bounds); 179 connection_manager_->root()->SetBounds(bounds);
180 connection_manager_->ProcessViewportMetricsChanged(metrics_, *metrics);
180 if (!surface_allocated_) 181 if (!surface_allocated_)
181 return; 182 return;
182 surface_->DestroySurface(kLocalSurfaceID); 183 surface_->DestroySurface(kLocalSurfaceID);
183 surface_allocated_ = false; 184 surface_allocated_ = false;
184 SchedulePaint(connection_manager_->root(), bounds); 185 SchedulePaint(connection_manager_->root(), bounds);
185 } 186 }
186 187
187 void DefaultDisplayManager::SetIdNamespace(uint32_t id_namespace) { 188 void DefaultDisplayManager::SetIdNamespace(uint32_t id_namespace) {
188 id_namespace_ = id_namespace; 189 id_namespace_ = id_namespace;
189 if (surface_allocated_) { 190 if (surface_allocated_) {
190 auto qualified_id = mojo::SurfaceId::New(); 191 auto qualified_id = mojo::SurfaceId::New();
191 qualified_id->id_namespace = id_namespace_; 192 qualified_id->id_namespace = id_namespace_;
192 qualified_id->local = kLocalSurfaceID; 193 qualified_id->local = kLocalSurfaceID;
193 native_viewport_->SubmittedFrame(qualified_id.Pass()); 194 native_viewport_->SubmittedFrame(qualified_id.Pass());
194 } 195 }
195 } 196 }
196 197
197 void DefaultDisplayManager::ReturnResources( 198 void DefaultDisplayManager::ReturnResources(
198 mojo::Array<mojo::ReturnedResourcePtr> resources) { 199 mojo::Array<mojo::ReturnedResourcePtr> resources) {
199 DCHECK_EQ(0u, resources.size()); 200 DCHECK_EQ(0u, resources.size());
200 } 201 }
201 202
202 } // namespace view_manager 203 } // namespace view_manager
OLDNEW
« no previous file with comments | « services/view_manager/connection_manager.cc ('k') | services/view_manager/server_view_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698