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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 "gpu/command_buffer/client/gles2_interface.h" | 28 #include "gpu/command_buffer/client/gles2_interface.h" |
29 #include "ui/gfx/frame_time.h" | 29 #include "ui/gfx/frame_time.h" |
30 | 30 |
| 31 namespace cc { |
| 32 |
31 namespace { | 33 namespace { |
32 | 34 |
33 // Measured in seconds. | 35 // Measured in seconds. |
34 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 36 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
35 | 37 |
36 unsigned int nextBeginFrameId = 0; | 38 unsigned int nextBeginFrameId = 0; |
37 | 39 |
38 class SwapPromiseChecker { | 40 class SwapPromiseChecker { |
39 public: | 41 public: |
40 explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host) | 42 explicit SwapPromiseChecker(LayerTreeHost* layer_tree_host) |
41 : layer_tree_host_(layer_tree_host) {} | 43 : layer_tree_host_(layer_tree_host) {} |
42 | 44 |
43 ~SwapPromiseChecker() { | 45 ~SwapPromiseChecker() { |
44 layer_tree_host_->BreakSwapPromises(cc::SwapPromise::COMMIT_FAILS); | 46 layer_tree_host_->BreakSwapPromises(SwapPromise::COMMIT_FAILS); |
45 } | 47 } |
46 | 48 |
47 private: | 49 private: |
48 cc::LayerTreeHost* layer_tree_host_; | 50 LayerTreeHost* layer_tree_host_; |
49 }; | 51 }; |
50 | 52 |
51 } // namespace | 53 } // namespace |
52 | 54 |
53 namespace cc { | |
54 | |
55 struct ThreadProxy::CommitPendingRequest { | 55 struct ThreadProxy::CommitPendingRequest { |
56 CompletionEvent completion; | 56 CompletionEvent completion; |
57 bool commit_pending; | 57 bool commit_pending; |
58 }; | 58 }; |
59 | 59 |
60 struct ThreadProxy::SchedulerStateRequest { | 60 struct ThreadProxy::SchedulerStateRequest { |
61 CompletionEvent completion; | 61 CompletionEvent completion; |
62 scoped_ptr<base::Value> state; | 62 scoped_ptr<base::Value> state; |
63 }; | 63 }; |
64 | 64 |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 FROM_HERE, | 848 FROM_HERE, |
849 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, | 849 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, |
850 impl_thread_weak_ptr_, | 850 impl_thread_weak_ptr_, |
851 did_handle)); | 851 did_handle)); |
852 | 852 |
853 // Although the commit is internally aborted, this is because it has been | 853 // Although the commit is internally aborted, this is because it has been |
854 // detected to be a no-op. From the perspective of an embedder, this commit | 854 // detected to be a no-op. From the perspective of an embedder, this commit |
855 // went through, and input should no longer be throttled, etc. | 855 // went through, and input should no longer be throttled, etc. |
856 layer_tree_host()->CommitComplete(); | 856 layer_tree_host()->CommitComplete(); |
857 layer_tree_host()->DidBeginMainFrame(); | 857 layer_tree_host()->DidBeginMainFrame(); |
| 858 layer_tree_host()->BreakSwapPromises(SwapPromise::COMMIT_NO_UPDATE); |
858 return; | 859 return; |
859 } | 860 } |
860 | 861 |
861 // Notify the impl thread that the main thread is ready to commit. This will | 862 // Notify the impl thread that the main thread is ready to commit. This will |
862 // begin the commit process, which is blocking from the main thread's | 863 // begin the commit process, which is blocking from the main thread's |
863 // point of view, but asynchronously performed on the impl thread, | 864 // point of view, but asynchronously performed on the impl thread, |
864 // coordinated by the Scheduler. | 865 // coordinated by the Scheduler. |
865 { | 866 { |
866 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); | 867 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); |
867 | 868 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 | 1456 |
1456 impl().timing_history.DidActivateSyncTree(); | 1457 impl().timing_history.DidActivateSyncTree(); |
1457 } | 1458 } |
1458 | 1459 |
1459 void ThreadProxy::DidManageTiles() { | 1460 void ThreadProxy::DidManageTiles() { |
1460 DCHECK(IsImplThread()); | 1461 DCHECK(IsImplThread()); |
1461 impl().scheduler->DidManageTiles(); | 1462 impl().scheduler->DidManageTiles(); |
1462 } | 1463 } |
1463 | 1464 |
1464 } // namespace cc | 1465 } // namespace cc |
OLD | NEW |