| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 void Compositor::Terminate() { | 442 void Compositor::Terminate() { |
| 443 if (g_compositor_thread) { | 443 if (g_compositor_thread) { |
| 444 g_compositor_thread->Stop(); | 444 g_compositor_thread->Stop(); |
| 445 delete g_compositor_thread; | 445 delete g_compositor_thread; |
| 446 g_compositor_thread = NULL; | 446 g_compositor_thread = NULL; |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 | 449 |
| 450 void Compositor::ScheduleDraw() { | 450 void Compositor::ScheduleDraw() { |
| 451 if (g_compositor_thread) | 451 if (g_compositor_thread) |
| 452 host_->Composite(); | 452 host_->Composite(base::TimeTicks::Now()); |
| 453 else if (delegate_) | 453 else if (delegate_) |
| 454 delegate_->ScheduleDraw(); | 454 delegate_->ScheduleDraw(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void Compositor::SetRootLayer(Layer* root_layer) { | 457 void Compositor::SetRootLayer(Layer* root_layer) { |
| 458 if (root_layer_ == root_layer) | 458 if (root_layer_ == root_layer) |
| 459 return; | 459 return; |
| 460 if (root_layer_) | 460 if (root_layer_) |
| 461 root_layer_->SetCompositor(NULL); | 461 root_layer_->SetCompositor(NULL); |
| 462 root_layer_ = root_layer; | 462 root_layer_ = root_layer; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 477 | 477 |
| 478 if (!root_layer_) | 478 if (!root_layer_) |
| 479 return; | 479 return; |
| 480 | 480 |
| 481 last_started_frame_++; | 481 last_started_frame_++; |
| 482 PendingSwap pending_swap(DRAW_SWAP, posted_swaps_.get()); | 482 PendingSwap pending_swap(DRAW_SWAP, posted_swaps_.get()); |
| 483 if (!IsLocked()) { | 483 if (!IsLocked()) { |
| 484 // TODO(nduca): Temporary while compositor calls | 484 // TODO(nduca): Temporary while compositor calls |
| 485 // compositeImmediately() directly. | 485 // compositeImmediately() directly. |
| 486 layout(); | 486 layout(); |
| 487 host_->Composite(); | 487 host_->Composite(base::TimeTicks::Now()); |
| 488 } | 488 } |
| 489 if (!pending_swap.posted()) | 489 if (!pending_swap.posted()) |
| 490 NotifyEnd(); | 490 NotifyEnd(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void Compositor::ScheduleFullDraw() { | 493 void Compositor::ScheduleFullDraw() { |
| 494 host_->SetNeedsRedraw(); | 494 host_->SetNeedsRedraw(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 bool Compositor::ReadPixels(SkBitmap* bitmap, | 497 bool Compositor::ReadPixels(SkBitmap* bitmap, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 COMPOSITOR_EXPORT void DisableTestCompositor() { | 695 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 696 ResetImplicitFactory(); | 696 ResetImplicitFactory(); |
| 697 g_test_compositor_enabled = false; | 697 g_test_compositor_enabled = false; |
| 698 } | 698 } |
| 699 | 699 |
| 700 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 700 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 701 return g_test_compositor_enabled; | 701 return g_test_compositor_enabled; |
| 702 } | 702 } |
| 703 | 703 |
| 704 } // namespace ui | 704 } // namespace ui |
| OLD | NEW |