| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 if (root_layer_) | 467 if (root_layer_) |
| 468 root_layer_->SetCompositor(NULL); | 468 root_layer_->SetCompositor(NULL); |
| 469 | 469 |
| 470 // Stop all outstanding draws before telling the ContextFactory to tear | 470 // Stop all outstanding draws before telling the ContextFactory to tear |
| 471 // down any contexts that the |host_| may rely upon. | 471 // down any contexts that the |host_| may rely upon. |
| 472 host_.reset(); | 472 host_.reset(); |
| 473 | 473 |
| 474 ContextFactory::GetInstance()->RemoveCompositor(this); | 474 ContextFactory::GetInstance()->RemoveCompositor(this); |
| 475 } | 475 } |
| 476 | 476 |
| 477 // static |
| 477 void Compositor::Initialize(bool use_thread) { | 478 void Compositor::Initialize(bool use_thread) { |
| 478 if (use_thread) { | 479 if (use_thread) { |
| 479 g_compositor_thread = new base::Thread("Browser Compositor"); | 480 g_compositor_thread = new base::Thread("Browser Compositor"); |
| 480 g_compositor_thread->Start(); | 481 g_compositor_thread->Start(); |
| 481 } | 482 } |
| 482 } | 483 } |
| 483 | 484 |
| 485 // static |
| 486 bool Compositor::WasInitializedWithThread() { |
| 487 return !!g_compositor_thread; |
| 488 } |
| 489 |
| 490 // static |
| 484 void Compositor::Terminate() { | 491 void Compositor::Terminate() { |
| 485 if (g_compositor_thread) { | 492 if (g_compositor_thread) { |
| 486 g_compositor_thread->Stop(); | 493 g_compositor_thread->Stop(); |
| 487 delete g_compositor_thread; | 494 delete g_compositor_thread; |
| 488 g_compositor_thread = NULL; | 495 g_compositor_thread = NULL; |
| 489 } | 496 } |
| 490 } | 497 } |
| 491 | 498 |
| 492 void Compositor::ScheduleDraw() { | 499 void Compositor::ScheduleDraw() { |
| 493 if (g_compositor_thread) | 500 if (g_compositor_thread) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 COMPOSITOR_EXPORT void DisableTestCompositor() { | 736 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 730 ResetImplicitFactory(); | 737 ResetImplicitFactory(); |
| 731 g_test_compositor_enabled = false; | 738 g_test_compositor_enabled = false; |
| 732 } | 739 } |
| 733 | 740 |
| 734 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 741 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 735 return g_test_compositor_enabled; | 742 return g_test_compositor_enabled; |
| 736 } | 743 } |
| 737 | 744 |
| 738 } // namespace ui | 745 } // namespace ui |
| OLD | NEW |