| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 void Compositor::ScheduleFullRedraw() { | 251 void Compositor::ScheduleFullRedraw() { |
| 252 host_->SetNeedsRedraw(); | 252 host_->SetNeedsRedraw(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { | 255 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { |
| 256 host_->SetNeedsRedrawRect(damage_rect); | 256 host_->SetNeedsRedrawRect(damage_rect); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void Compositor::FinishAllRendering() { | 259 void Compositor::DisableSwapUntilResize() { |
| 260 host_->FinishAllRendering(); | 260 host_->FinishAllRendering(); |
| 261 context_factory_->ResizeDisplay(this, gfx::Size()); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { | 264 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { |
| 264 scoped_ptr<cc::SwapPromise> swap_promise( | 265 scoped_ptr<cc::SwapPromise> swap_promise( |
| 265 new cc::LatencyInfoSwapPromise(latency_info)); | 266 new cc::LatencyInfoSwapPromise(latency_info)); |
| 266 host_->QueueSwapPromise(swap_promise.Pass()); | 267 host_->QueueSwapPromise(swap_promise.Pass()); |
| 267 } | 268 } |
| 268 | 269 |
| 269 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { | 270 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { |
| 270 DCHECK_GT(scale, 0); | 271 DCHECK_GT(scale, 0); |
| 271 if (!size_in_pixel.IsEmpty()) { | 272 if (!size_in_pixel.IsEmpty()) { |
| 272 size_ = size_in_pixel; | 273 size_ = size_in_pixel; |
| 273 host_->SetViewportSize(size_in_pixel); | 274 host_->SetViewportSize(size_in_pixel); |
| 274 root_web_layer_->SetBounds(size_in_pixel); | 275 root_web_layer_->SetBounds(size_in_pixel); |
| 276 context_factory_->ResizeDisplay(this, size_in_pixel); |
| 275 } | 277 } |
| 276 if (device_scale_factor_ != scale) { | 278 if (device_scale_factor_ != scale) { |
| 277 device_scale_factor_ = scale; | 279 device_scale_factor_ = scale; |
| 278 host_->SetDeviceScaleFactor(scale); | 280 host_->SetDeviceScaleFactor(scale); |
| 279 if (root_layer_) | 281 if (root_layer_) |
| 280 root_layer_->OnDeviceScaleFactorChanged(scale); | 282 root_layer_->OnDeviceScaleFactorChanged(scale); |
| 281 } | 283 } |
| 282 } | 284 } |
| 283 | 285 |
| 284 void Compositor::SetBackgroundColor(SkColor color) { | 286 void Compositor::SetBackgroundColor(SkColor color) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 // Call ScheduleDraw() instead of Draw() in order to allow other | 462 // Call ScheduleDraw() instead of Draw() in order to allow other |
| 461 // CompositorObservers to be notified before starting another | 463 // CompositorObservers to be notified before starting another |
| 462 // draw cycle. | 464 // draw cycle. |
| 463 ScheduleDraw(); | 465 ScheduleDraw(); |
| 464 } | 466 } |
| 465 FOR_EACH_OBSERVER( | 467 FOR_EACH_OBSERVER( |
| 466 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 468 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
| 467 } | 469 } |
| 468 | 470 |
| 469 } // namespace ui | 471 } // namespace ui |
| OLD | NEW |