Chromium Code Reviews| 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/surfaces/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/output/in_process_context_provider.h" | 9 #include "cc/output/in_process_context_provider.h" |
| 10 #include "cc/output/texture_mailbox_deleter.h" | 10 #include "cc/output/texture_mailbox_deleter.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 } | 219 } |
| 220 | 220 |
| 221 const cc::SurfaceId& DisplayCompositor::GetRootSurfaceId() const { | 221 const cc::SurfaceId& DisplayCompositor::GetRootSurfaceId() const { |
| 222 return reference_manager_->GetRootSurfaceId(); | 222 return reference_manager_->GetRootSurfaceId(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceId& surface_id, | 225 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceId& surface_id, |
| 226 const gfx::Size& frame_size, | 226 const gfx::Size& frame_size, |
| 227 float device_scale_factor) { | 227 float device_scale_factor) { |
| 228 DCHECK(thread_checker_.CalledOnValidThread()); | 228 DCHECK(thread_checker_.CalledOnValidThread()); |
| 229 DCHECK(device_scale_factor); | |
|
kylechar
2016/12/15 18:25:03
DCHECK_GT(device_scale_factor, 0.0f) maybe so it's
riajiang
2016/12/15 19:01:43
Done.
| |
| 229 // We can get into a situation where multiple CompositorFrames arrive for a | 230 // We can get into a situation where multiple CompositorFrames arrive for a |
| 230 // CompositorFrameSink before the DisplayCompositorClient can add any | 231 // CompositorFrameSink before the DisplayCompositorClient can add any |
| 231 // references for the frame. When the second frame with a new size arrives, | 232 // references for the frame. When the second frame with a new size arrives, |
| 232 // the first will be destroyed and then if there are no references it will be | 233 // the first will be destroyed and then if there are no references it will be |
| 233 // deleted during surface GC. A temporary reference, removed when a real | 234 // deleted during surface GC. A temporary reference, removed when a real |
| 234 // reference is received, is added to prevent this from happening. | 235 // reference is received, is added to prevent this from happening. |
| 235 reference_manager_->AddSurfaceReference(GetRootSurfaceId(), surface_id); | 236 reference_manager_->AddSurfaceReference(GetRootSurfaceId(), surface_id); |
| 236 temp_references_[surface_id.frame_sink_id()].push_back( | 237 temp_references_[surface_id.frame_sink_id()].push_back( |
| 237 surface_id.local_frame_id()); | 238 surface_id.local_frame_id()); |
| 238 | 239 |
| 239 if (client_) | 240 if (client_) |
| 240 client_->OnSurfaceCreated(surface_id, frame_size, device_scale_factor); | 241 client_->OnSurfaceCreated(surface_id, frame_size, device_scale_factor); |
| 241 } | 242 } |
| 242 | 243 |
| 243 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 244 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
| 244 bool* changed) {} | 245 bool* changed) {} |
| 245 | 246 |
| 246 } // namespace ui | 247 } // namespace ui |
| OLD | NEW |