| 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/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 18 #include "cc/base/switches.h" | 19 #include "cc/base/switches.h" |
| 19 #include "cc/debug/test_context_provider.h" | 20 #include "cc/debug/test_context_provider.h" |
| 20 #include "cc/debug/test_web_graphics_context_3d.h" | 21 #include "cc/debug/test_web_graphics_context_3d.h" |
| 21 #include "cc/input/input_handler.h" | 22 #include "cc/input/input_handler.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 412 |
| 412 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = | 413 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
| 413 g_compositor_thread ? g_compositor_thread->message_loop_proxy() : NULL; | 414 g_compositor_thread ? g_compositor_thread->message_loop_proxy() : NULL; |
| 414 | 415 |
| 415 host_ = cc::LayerTreeHost::Create(this, settings, compositor_task_runner); | 416 host_ = cc::LayerTreeHost::Create(this, settings, compositor_task_runner); |
| 416 host_->SetRootLayer(root_web_layer_); | 417 host_->SetRootLayer(root_web_layer_); |
| 417 host_->SetLayerTreeHostClientReady(); | 418 host_->SetLayerTreeHostClientReady(); |
| 418 } | 419 } |
| 419 | 420 |
| 420 Compositor::~Compositor() { | 421 Compositor::~Compositor() { |
| 422 TRACE_EVENT0("shutdown", "Compositor::destructor"); |
| 423 |
| 421 DCHECK(g_compositor_initialized); | 424 DCHECK(g_compositor_initialized); |
| 422 | 425 |
| 423 CancelCompositorLock(); | 426 CancelCompositorLock(); |
| 424 DCHECK(!compositor_lock_); | 427 DCHECK(!compositor_lock_); |
| 425 | 428 |
| 426 // Don't call |CompositorDelegate::ScheduleDraw| from this point. | 429 // Don't call |CompositorDelegate::ScheduleDraw| from this point. |
| 427 delegate_ = NULL; | 430 delegate_ = NULL; |
| 428 if (root_layer_) | 431 if (root_layer_) |
| 429 root_layer_->SetCompositor(NULL); | 432 root_layer_->SetCompositor(NULL); |
| 430 | 433 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 767 } |
| 765 | 768 |
| 766 void Compositor::NotifyEnd() { | 769 void Compositor::NotifyEnd() { |
| 767 last_ended_frame_++; | 770 last_ended_frame_++; |
| 768 FOR_EACH_OBSERVER(CompositorObserver, | 771 FOR_EACH_OBSERVER(CompositorObserver, |
| 769 observer_list_, | 772 observer_list_, |
| 770 OnCompositingEnded(this)); | 773 OnCompositingEnded(this)); |
| 771 } | 774 } |
| 772 | 775 |
| 773 } // namespace ui | 776 } // namespace ui |
| OLD | NEW |