Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 462803002: Fix failing (flaky) LayerTreeHostTestLCDNotification test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ~SwapPromiseChecker() { 45 ~SwapPromiseChecker() {
46 layer_tree_host_->BreakSwapPromises(SwapPromise::COMMIT_FAILS); 46 layer_tree_host_->BreakSwapPromises(SwapPromise::COMMIT_FAILS);
47 } 47 }
48 48
49 private: 49 private:
50 LayerTreeHost* layer_tree_host_; 50 LayerTreeHost* layer_tree_host_;
51 }; 51 };
52 52
53 } // namespace 53 } // namespace
54 54
55 struct ThreadProxy::CommitPendingRequest {
56 CompletionEvent completion;
57 bool commit_pending;
58 };
59
60 struct ThreadProxy::SchedulerStateRequest { 55 struct ThreadProxy::SchedulerStateRequest {
61 CompletionEvent completion; 56 CompletionEvent completion;
62 scoped_ptr<base::Value> state; 57 scoped_ptr<base::Value> state;
63 }; 58 };
64 59
65 scoped_ptr<Proxy> ThreadProxy::Create( 60 scoped_ptr<Proxy> ThreadProxy::Create(
66 LayerTreeHost* layer_tree_host, 61 LayerTreeHost* layer_tree_host,
67 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 62 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
68 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 63 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
69 return make_scoped_ptr(new ThreadProxy(layer_tree_host, 64 return make_scoped_ptr(new ThreadProxy(layer_tree_host,
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 } 1297 }
1303 1298
1304 void ThreadProxy::AsValueOnImplThread(CompletionEvent* completion, 1299 void ThreadProxy::AsValueOnImplThread(CompletionEvent* completion,
1305 base::debug::TracedValue* state) const { 1300 base::debug::TracedValue* state) const {
1306 state->BeginDictionary("layer_tree_host_impl"); 1301 state->BeginDictionary("layer_tree_host_impl");
1307 impl().layer_tree_host_impl->AsValueInto(state); 1302 impl().layer_tree_host_impl->AsValueInto(state);
1308 state->EndDictionary(); 1303 state->EndDictionary();
1309 completion->Signal(); 1304 completion->Signal();
1310 } 1305 }
1311 1306
1312 bool ThreadProxy::CommitPendingForTesting() { 1307 bool ThreadProxy::MainFrameWillHappenForTesting() {
1313 DCHECK(IsMainThread()); 1308 DCHECK(IsMainThread());
1314 CommitPendingRequest commit_pending_request; 1309 CompletionEvent completion;
1310 bool main_frame_will_happen = false;
1315 { 1311 {
1316 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 1312 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
1317 Proxy::ImplThreadTaskRunner()->PostTask( 1313 Proxy::ImplThreadTaskRunner()->PostTask(
1318 FROM_HERE, 1314 FROM_HERE,
1319 base::Bind(&ThreadProxy::CommitPendingOnImplThreadForTesting, 1315 base::Bind(&ThreadProxy::MainFrameWillHappenOnImplThreadForTesting,
1320 impl_thread_weak_ptr_, 1316 impl_thread_weak_ptr_,
1321 &commit_pending_request)); 1317 &completion,
1322 commit_pending_request.completion.Wait(); 1318 &main_frame_will_happen));
1319 completion.Wait();
1323 } 1320 }
1324 return commit_pending_request.commit_pending; 1321 return main_frame_will_happen;
1325 } 1322 }
1326 1323
1327 void ThreadProxy::CommitPendingOnImplThreadForTesting( 1324 void ThreadProxy::MainFrameWillHappenOnImplThreadForTesting(
1328 CommitPendingRequest* request) { 1325 CompletionEvent* completion,
1326 bool* main_frame_will_happen) {
1329 DCHECK(IsImplThread()); 1327 DCHECK(IsImplThread());
1330 if (impl().layer_tree_host_impl->output_surface()) 1328 if (impl().layer_tree_host_impl->output_surface()) {
1331 request->commit_pending = impl().scheduler->CommitPending(); 1329 *main_frame_will_happen = impl().scheduler->MainFrameForTestingWillHappen();
1332 else 1330 } else {
1333 request->commit_pending = false; 1331 *main_frame_will_happen = false;
1334 request->completion.Signal(); 1332 }
1333 completion->Signal();
1335 } 1334 }
1336 1335
1337 void ThreadProxy::RenewTreePriority() { 1336 void ThreadProxy::RenewTreePriority() {
1338 DCHECK(IsImplThread()); 1337 DCHECK(IsImplThread());
1339 bool smoothness_takes_priority = 1338 bool smoothness_takes_priority =
1340 impl().layer_tree_host_impl->pinch_gesture_active() || 1339 impl().layer_tree_host_impl->pinch_gesture_active() ||
1341 impl().layer_tree_host_impl->page_scale_animation_active() || 1340 impl().layer_tree_host_impl->page_scale_animation_active() ||
1342 (impl().layer_tree_host_impl->IsCurrentlyScrolling() && 1341 (impl().layer_tree_host_impl->IsCurrentlyScrolling() &&
1343 !impl().layer_tree_host_impl->scroll_affects_scroll_handler()); 1342 !impl().layer_tree_host_impl->scroll_affects_scroll_handler());
1344 1343
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 1401
1403 impl().timing_history.DidActivateSyncTree(); 1402 impl().timing_history.DidActivateSyncTree();
1404 } 1403 }
1405 1404
1406 void ThreadProxy::DidManageTiles() { 1405 void ThreadProxy::DidManageTiles() {
1407 DCHECK(IsImplThread()); 1406 DCHECK(IsImplThread());
1408 impl().scheduler->DidManageTiles(); 1407 impl().scheduler->DidManageTiles();
1409 } 1408 }
1410 1409
1411 } // namespace cc 1410 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698