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

Side by Side Diff: services/ui/surfaces/display_compositor.cc

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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 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/surfaces/display_compositor.h" 5 #include "services/ui/surfaces/display_compositor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 this, frame_sink_id, std::move(display), 244 this, frame_sink_id, std::move(display),
245 std::move(begin_frame_source), std::move(request), 245 std::move(begin_frame_source), std::move(request),
246 std::move(private_request), std::move(client), 246 std::move(private_request), std::move(client),
247 std::move(display_request)); 247 std::move(display_request));
248 } 248 }
249 249
250 const cc::SurfaceId& DisplayCompositor::GetRootSurfaceId() const { 250 const cc::SurfaceId& DisplayCompositor::GetRootSurfaceId() const {
251 return reference_manager_->GetRootSurfaceId(); 251 return reference_manager_->GetRootSurfaceId();
252 } 252 }
253 253
254 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceId& surface_id, 254 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
255 const gfx::Size& frame_size,
256 float device_scale_factor) {
257 DCHECK(thread_checker_.CalledOnValidThread()); 255 DCHECK(thread_checker_.CalledOnValidThread());
258 DCHECK_GT(device_scale_factor, 0.0f); 256 DCHECK_GT(surface_info.device_scale_factor(), 0.0f);
259 // We can get into a situation where multiple CompositorFrames arrive for a 257 // We can get into a situation where multiple CompositorFrames arrive for a
260 // CompositorFrameSink before the DisplayCompositorClient can add any 258 // CompositorFrameSink before the DisplayCompositorClient can add any
261 // references for the frame. When the second frame with a new size arrives, 259 // references for the frame. When the second frame with a new size arrives,
262 // the first will be destroyed and then if there are no references it will be 260 // the first will be destroyed and then if there are no references it will be
263 // deleted during surface GC. A temporary reference, removed when a real 261 // deleted during surface GC. A temporary reference, removed when a real
264 // reference is received, is added to prevent this from happening. 262 // reference is received, is added to prevent this from happening.
265 reference_manager_->AddSurfaceReference(GetRootSurfaceId(), surface_id); 263 reference_manager_->AddSurfaceReference(GetRootSurfaceId(),
266 temp_references_[surface_id.frame_sink_id()].push_back( 264 surface_info.id());
267 surface_id.local_frame_id()); 265 temp_references_[surface_info.id().frame_sink_id()].push_back(
266 surface_info.id().local_frame_id());
268 267
269 if (client_) 268 if (client_)
270 client_->OnSurfaceCreated(surface_id, frame_size, device_scale_factor); 269 client_->OnSurfaceCreated(surface_info);
271 } 270 }
272 271
273 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, 272 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id,
274 bool* changed) {} 273 bool* changed) {}
275 274
276 } // namespace ui 275 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/display_compositor.h ('k') | services/ui/surfaces/display_compositor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698