| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/debug/trace_event_synthetic_delay.h" | 13 #include "base/debug/trace_event_synthetic_delay.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "cc/base/swap_promise.h" | 15 #include "cc/base/swap_promise.h" |
| 16 #include "cc/debug/benchmark_instrumentation.h" | 16 #include "cc/debug/benchmark_instrumentation.h" |
| 17 #include "cc/debug/devtools_instrumentation.h" | 17 #include "cc/debug/devtools_instrumentation.h" |
| 18 #include "cc/input/input_handler.h" | 18 #include "cc/input/input_handler.h" |
| 19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
| 20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 21 #include "cc/quads/draw_quad.h" | 21 #include "cc/quads/draw_quad.h" |
| 22 #include "cc/resources/prioritized_resource_manager.h" | 22 #include "cc/resources/prioritized_resource_manager.h" |
| 23 #include "cc/scheduler/delay_based_time_source.h" | 23 #include "cc/scheduler/delay_based_time_source.h" |
| 24 #include "cc/scheduler/scheduler.h" | 24 #include "cc/scheduler/scheduler.h" |
| 25 #include "cc/trees/blocking_task_runner.h" | 25 #include "cc/trees/blocking_task_runner.h" |
| 26 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
| 27 #include "cc/trees/layer_tree_impl.h" | 27 #include "cc/trees/layer_tree_impl.h" |
| 28 #include "ui/gfx/frame_time.h" | 28 #include "ui/gfx/frame_time.h" |
| 29 | 29 |
| 30 namespace cc { |
| 31 |
| 30 namespace { | 32 namespace { |
| 31 | 33 |
| 32 // Measured in seconds. | 34 // Measured in seconds. |
| 33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 35 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
| 34 | 36 |
| 35 class SwapPromiseChecker { | 37 class SwapPromiseChecker { |
| 36 public: | 38 public: |
| 37 explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host) | 39 explicit SwapPromiseChecker(LayerTreeHost* layer_tree_host) |
| 38 : layer_tree_host_(layer_tree_host) {} | 40 : layer_tree_host_(layer_tree_host) {} |
| 39 | 41 |
| 40 ~SwapPromiseChecker() { | 42 ~SwapPromiseChecker() { |
| 41 layer_tree_host_->BreakSwapPromises(cc::SwapPromise::COMMIT_FAILS); | 43 layer_tree_host_->BreakSwapPromises(SwapPromise::COMMIT_FAILS); |
| 42 } | 44 } |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 cc::LayerTreeHost* layer_tree_host_; | 47 LayerTreeHost* layer_tree_host_; |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 } // namespace | 50 } // namespace |
| 49 | 51 |
| 50 namespace cc { | |
| 51 | |
| 52 struct ThreadProxy::CommitPendingRequest { | 52 struct ThreadProxy::CommitPendingRequest { |
| 53 CompletionEvent completion; | 53 CompletionEvent completion; |
| 54 bool commit_pending; | 54 bool commit_pending; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 struct ThreadProxy::SchedulerStateRequest { | 57 struct ThreadProxy::SchedulerStateRequest { |
| 58 CompletionEvent completion; | 58 CompletionEvent completion; |
| 59 scoped_ptr<base::Value> state; | 59 scoped_ptr<base::Value> state; |
| 60 }; | 60 }; |
| 61 | 61 |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 FROM_HERE, | 832 FROM_HERE, |
| 833 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, | 833 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, |
| 834 impl_thread_weak_ptr_, | 834 impl_thread_weak_ptr_, |
| 835 did_handle)); | 835 did_handle)); |
| 836 | 836 |
| 837 // Although the commit is internally aborted, this is because it has been | 837 // Although the commit is internally aborted, this is because it has been |
| 838 // detected to be a no-op. From the perspective of an embedder, this commit | 838 // detected to be a no-op. From the perspective of an embedder, this commit |
| 839 // went through, and input should no longer be throttled, etc. | 839 // went through, and input should no longer be throttled, etc. |
| 840 layer_tree_host()->CommitComplete(); | 840 layer_tree_host()->CommitComplete(); |
| 841 layer_tree_host()->DidBeginMainFrame(); | 841 layer_tree_host()->DidBeginMainFrame(); |
| 842 layer_tree_host()->BreakSwapPromises(SwapPromise::COMMIT_NO_UPDATE); |
| 842 return; | 843 return; |
| 843 } | 844 } |
| 844 | 845 |
| 845 // Notify the impl thread that the main thread is ready to commit. This will | 846 // Notify the impl thread that the main thread is ready to commit. This will |
| 846 // begin the commit process, which is blocking from the main thread's | 847 // begin the commit process, which is blocking from the main thread's |
| 847 // point of view, but asynchronously performed on the impl thread, | 848 // point of view, but asynchronously performed on the impl thread, |
| 848 // coordinated by the Scheduler. | 849 // coordinated by the Scheduler. |
| 849 { | 850 { |
| 850 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); | 851 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); |
| 851 | 852 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 | 1436 |
| 1436 impl().timing_history.DidActivatePendingTree(); | 1437 impl().timing_history.DidActivatePendingTree(); |
| 1437 } | 1438 } |
| 1438 | 1439 |
| 1439 void ThreadProxy::DidManageTiles() { | 1440 void ThreadProxy::DidManageTiles() { |
| 1440 DCHECK(IsImplThread()); | 1441 DCHECK(IsImplThread()); |
| 1441 impl().scheduler->DidManageTiles(); | 1442 impl().scheduler->DidManageTiles(); |
| 1442 } | 1443 } |
| 1443 | 1444 |
| 1444 } // namespace cc | 1445 } // namespace cc |
| OLD | NEW |