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/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
19 #include "cc/base/thread_impl.h" | |
20 #include "cc/input/input_handler.h" | 19 #include "cc/input/input_handler.h" |
21 #include "cc/layers/layer.h" | 20 #include "cc/layers/layer.h" |
22 #include "cc/output/context_provider.h" | 21 #include "cc/output/context_provider.h" |
23 #include "cc/output/output_surface.h" | 22 #include "cc/output/output_surface.h" |
24 #include "cc/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "ui/compositor/compositor_observer.h" | 25 #include "ui/compositor/compositor_observer.h" |
27 #include "ui/compositor/compositor_switches.h" | 26 #include "ui/compositor/compositor_switches.h" |
28 #include "ui/compositor/dip_util.h" | 27 #include "ui/compositor/dip_util.h" |
29 #include "ui/compositor/layer.h" | 28 #include "ui/compositor/layer.h" |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); | 515 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); |
517 settings.initial_debug_state.show_screen_space_rects = | 516 settings.initial_debug_state.show_screen_space_rects = |
518 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); | 517 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); |
519 settings.initial_debug_state.show_replica_screen_space_rects = | 518 settings.initial_debug_state.show_replica_screen_space_rects = |
520 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 519 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
521 settings.initial_debug_state.show_occluding_rects = | 520 settings.initial_debug_state.show_occluding_rects = |
522 command_line->HasSwitch(cc::switches::kUIShowOccludingRects); | 521 command_line->HasSwitch(cc::switches::kUIShowOccludingRects); |
523 settings.initial_debug_state.show_non_occluding_rects = | 522 settings.initial_debug_state.show_non_occluding_rects = |
524 command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects); | 523 command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects); |
525 | 524 |
526 scoped_ptr<cc::Thread> thread; | 525 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
527 if (g_compositor_thread) { | 526 g_compositor_thread ? g_compositor_thread->message_loop_proxy() : NULL; |
528 thread = cc::ThreadImpl::CreateForDifferentThread( | |
529 g_compositor_thread->message_loop_proxy()); | |
530 } | |
531 | 527 |
532 host_ = cc::LayerTreeHost::Create(this, settings, thread.Pass()); | 528 host_ = cc::LayerTreeHost::Create(this, settings, compositor_task_runner); |
533 host_->SetRootLayer(root_web_layer_); | 529 host_->SetRootLayer(root_web_layer_); |
534 host_->SetLayerTreeHostClientReady(); | 530 host_->SetLayerTreeHostClientReady(); |
535 } | 531 } |
536 | 532 |
537 Compositor::~Compositor() { | 533 Compositor::~Compositor() { |
538 CancelCompositorLock(); | 534 CancelCompositorLock(); |
539 DCHECK(!compositor_lock_); | 535 DCHECK(!compositor_lock_); |
540 | 536 |
541 // Don't call |CompositorDelegate::ScheduleDraw| from this point. | 537 // Don't call |CompositorDelegate::ScheduleDraw| from this point. |
542 delegate_ = NULL; | 538 delegate_ = NULL; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 COMPOSITOR_EXPORT void DisableTestCompositor() { | 848 COMPOSITOR_EXPORT void DisableTestCompositor() { |
853 ResetImplicitFactory(); | 849 ResetImplicitFactory(); |
854 g_test_compositor_enabled = false; | 850 g_test_compositor_enabled = false; |
855 } | 851 } |
856 | 852 |
857 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 853 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
858 return g_test_compositor_enabled; | 854 return g_test_compositor_enabled; |
859 } | 855 } |
860 | 856 |
861 } // namespace ui | 857 } // namespace ui |
OLD | NEW |