| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void Compositor::Terminate() { | 420 void Compositor::Terminate() { |
| 421 if (g_compositor_thread) { | 421 if (g_compositor_thread) { |
| 422 g_compositor_thread->Stop(); | 422 g_compositor_thread->Stop(); |
| 423 delete g_compositor_thread; | 423 delete g_compositor_thread; |
| 424 g_compositor_thread = NULL; | 424 g_compositor_thread = NULL; |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 void Compositor::ScheduleDraw() { | 428 void Compositor::ScheduleDraw() { |
| 429 if (g_compositor_thread) | 429 if (g_compositor_thread) |
| 430 host_->composite(); | 430 host_->composite(base::TimeTicks::Now()); |
| 431 else if (delegate_) | 431 else if (delegate_) |
| 432 delegate_->ScheduleDraw(); | 432 delegate_->ScheduleDraw(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void Compositor::SetRootLayer(Layer* root_layer) { | 435 void Compositor::SetRootLayer(Layer* root_layer) { |
| 436 if (root_layer_ == root_layer) | 436 if (root_layer_ == root_layer) |
| 437 return; | 437 return; |
| 438 if (root_layer_) | 438 if (root_layer_) |
| 439 root_layer_->SetCompositor(NULL); | 439 root_layer_->SetCompositor(NULL); |
| 440 root_layer_ = root_layer; | 440 root_layer_ = root_layer; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 455 | 455 |
| 456 if (!root_layer_) | 456 if (!root_layer_) |
| 457 return; | 457 return; |
| 458 | 458 |
| 459 last_started_frame_++; | 459 last_started_frame_++; |
| 460 PendingSwap pending_swap(DRAW_SWAP, posted_swaps_.get()); | 460 PendingSwap pending_swap(DRAW_SWAP, posted_swaps_.get()); |
| 461 if (!IsLocked()) { | 461 if (!IsLocked()) { |
| 462 // TODO(nduca): Temporary while compositor calls | 462 // TODO(nduca): Temporary while compositor calls |
| 463 // compositeImmediately() directly. | 463 // compositeImmediately() directly. |
| 464 layout(); | 464 layout(); |
| 465 host_->composite(); | 465 host_->composite(base::TimeTicks::Now()); |
| 466 } | 466 } |
| 467 if (!pending_swap.posted()) | 467 if (!pending_swap.posted()) |
| 468 NotifyEnd(); | 468 NotifyEnd(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void Compositor::ScheduleFullDraw() { | 471 void Compositor::ScheduleFullDraw() { |
| 472 host_->setNeedsRedraw(); | 472 host_->setNeedsRedraw(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 bool Compositor::ReadPixels(SkBitmap* bitmap, | 475 bool Compositor::ReadPixels(SkBitmap* bitmap, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 693 |
| 694 COMPOSITOR_EXPORT void DisableTestCompositor() { | 694 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 695 g_test_compositor_enabled = false; | 695 g_test_compositor_enabled = false; |
| 696 } | 696 } |
| 697 | 697 |
| 698 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 698 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 699 return g_test_compositor_enabled; | 699 return g_test_compositor_enabled; |
| 700 } | 700 } |
| 701 | 701 |
| 702 } // namespace ui | 702 } // namespace ui |
| OLD | NEW |