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