| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 17 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
| 18 #include "cc/input/input_handler.h" | 19 #include "cc/input/input_handler.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Stop all outstanding draws before telling the ContextFactory to tear | 213 // Stop all outstanding draws before telling the ContextFactory to tear |
| 213 // down any contexts that the |host_| may rely upon. | 214 // down any contexts that the |host_| may rely upon. |
| 214 host_.reset(); | 215 host_.reset(); |
| 215 | 216 |
| 216 context_factory_->RemoveCompositor(this); | 217 context_factory_->RemoveCompositor(this); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void Compositor::SetOutputSurface( | 220 void Compositor::SetOutputSurface( |
| 220 scoped_ptr<cc::OutputSurface> output_surface) { | 221 scoped_ptr<cc::OutputSurface> output_surface) { |
| 221 output_surface_requested_ = false; | 222 output_surface_requested_ = false; |
| 222 host_->SetOutputSurface(output_surface.Pass()); | 223 host_->SetOutputSurface(std::move(output_surface)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 void Compositor::ScheduleDraw() { | 226 void Compositor::ScheduleDraw() { |
| 226 host_->SetNeedsCommit(); | 227 host_->SetNeedsCommit(); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void Compositor::SetRootLayer(Layer* root_layer) { | 230 void Compositor::SetRootLayer(Layer* root_layer) { |
| 230 if (root_layer_ == root_layer) | 231 if (root_layer_ == root_layer) |
| 231 return; | 232 return; |
| 232 if (root_layer_) | 233 if (root_layer_) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 262 } | 263 } |
| 263 | 264 |
| 264 void Compositor::DisableSwapUntilResize() { | 265 void Compositor::DisableSwapUntilResize() { |
| 265 host_->FinishAllRendering(); | 266 host_->FinishAllRendering(); |
| 266 context_factory_->ResizeDisplay(this, gfx::Size()); | 267 context_factory_->ResizeDisplay(this, gfx::Size()); |
| 267 } | 268 } |
| 268 | 269 |
| 269 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { | 270 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { |
| 270 scoped_ptr<cc::SwapPromise> swap_promise( | 271 scoped_ptr<cc::SwapPromise> swap_promise( |
| 271 new cc::LatencyInfoSwapPromise(latency_info)); | 272 new cc::LatencyInfoSwapPromise(latency_info)); |
| 272 host_->QueueSwapPromise(swap_promise.Pass()); | 273 host_->QueueSwapPromise(std::move(swap_promise)); |
| 273 } | 274 } |
| 274 | 275 |
| 275 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { | 276 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { |
| 276 DCHECK_GT(scale, 0); | 277 DCHECK_GT(scale, 0); |
| 277 if (!size_in_pixel.IsEmpty()) { | 278 if (!size_in_pixel.IsEmpty()) { |
| 278 size_ = size_in_pixel; | 279 size_ = size_in_pixel; |
| 279 host_->SetViewportSize(size_in_pixel); | 280 host_->SetViewportSize(size_in_pixel); |
| 280 root_web_layer_->SetBounds(size_in_pixel); | 281 root_web_layer_->SetBounds(size_in_pixel); |
| 281 context_factory_->ResizeDisplay(this, size_in_pixel); | 282 context_factory_->ResizeDisplay(this, size_in_pixel); |
| 282 } | 283 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 observer_list_, | 503 observer_list_, |
| 503 OnCompositingLockStateChanged(this)); | 504 OnCompositingLockStateChanged(this)); |
| 504 } | 505 } |
| 505 | 506 |
| 506 void Compositor::CancelCompositorLock() { | 507 void Compositor::CancelCompositorLock() { |
| 507 if (compositor_lock_) | 508 if (compositor_lock_) |
| 508 compositor_lock_->CancelLock(); | 509 compositor_lock_->CancelLock(); |
| 509 } | 510 } |
| 510 | 511 |
| 511 } // namespace ui | 512 } // namespace ui |
| OLD | NEW |