| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "cc/base/latency_info_swap_promise.h" | |
| 21 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 22 #include "cc/input/input_handler.h" | 21 #include "cc/input/input_handler.h" |
| 23 #include "cc/layers/layer.h" | 22 #include "cc/layers/layer.h" |
| 24 #include "cc/output/context_provider.h" | 23 #include "cc/output/context_provider.h" |
| 25 #include "cc/trees/layer_tree_host.h" | 24 #include "cc/trees/layer_tree_host.h" |
| 26 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
| 27 #include "ui/compositor/compositor_observer.h" | 26 #include "ui/compositor/compositor_observer.h" |
| 28 #include "ui/compositor/compositor_switches.h" | 27 #include "ui/compositor/compositor_switches.h" |
| 29 #include "ui/compositor/dip_util.h" | 28 #include "ui/compositor/dip_util.h" |
| 30 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 430 |
| 432 void Compositor::ScheduleFullRedraw() { | 431 void Compositor::ScheduleFullRedraw() { |
| 433 host_->SetNeedsRedraw(); | 432 host_->SetNeedsRedraw(); |
| 434 } | 433 } |
| 435 | 434 |
| 436 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { | 435 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { |
| 437 host_->SetNeedsRedrawRect(damage_rect); | 436 host_->SetNeedsRedrawRect(damage_rect); |
| 438 } | 437 } |
| 439 | 438 |
| 440 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { | 439 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { |
| 441 scoped_ptr<cc::SwapPromise> swap_promise( | 440 host_->SetLatencyInfo(latency_info); |
| 442 new cc::LatencyInfoSwapPromise(latency_info)); | |
| 443 host_->QueueSwapPromise(swap_promise.Pass()); | |
| 444 } | 441 } |
| 445 | 442 |
| 446 bool Compositor::ReadPixels(SkBitmap* bitmap, | 443 bool Compositor::ReadPixels(SkBitmap* bitmap, |
| 447 const gfx::Rect& bounds_in_pixel) { | 444 const gfx::Rect& bounds_in_pixel) { |
| 448 if (bounds_in_pixel.right() > size().width() || | 445 if (bounds_in_pixel.right() > size().width() || |
| 449 bounds_in_pixel.bottom() > size().height()) | 446 bounds_in_pixel.bottom() > size().height()) |
| 450 return false; | 447 return false; |
| 451 bitmap->setConfig(SkBitmap::kARGB_8888_Config, | 448 bitmap->setConfig(SkBitmap::kARGB_8888_Config, |
| 452 bounds_in_pixel.width(), bounds_in_pixel.height()); | 449 bounds_in_pixel.width(), bounds_in_pixel.height()); |
| 453 bitmap->allocPixels(); | 450 bitmap->allocPixels(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 // CompositorObservers to be notified before starting another | 616 // CompositorObservers to be notified before starting another |
| 620 // draw cycle. | 617 // draw cycle. |
| 621 ScheduleDraw(); | 618 ScheduleDraw(); |
| 622 } | 619 } |
| 623 FOR_EACH_OBSERVER(CompositorObserver, | 620 FOR_EACH_OBSERVER(CompositorObserver, |
| 624 observer_list_, | 621 observer_list_, |
| 625 OnCompositingEnded(this)); | 622 OnCompositingEnded(this)); |
| 626 } | 623 } |
| 627 | 624 |
| 628 } // namespace ui | 625 } // namespace ui |
| OLD | NEW |