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

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

Issue 522903002: cc: Be less aggressive about scheduling for scroll handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed scheduler part. Created 6 years, 3 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
« no previous file with comments | « cc/scheduler/scheduler_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 *main_frame_will_happen = false; 1327 *main_frame_will_happen = false;
1328 } 1328 }
1329 completion->Signal(); 1329 completion->Signal();
1330 } 1330 }
1331 1331
1332 void ThreadProxy::RenewTreePriority() { 1332 void ThreadProxy::RenewTreePriority() {
1333 DCHECK(IsImplThread()); 1333 DCHECK(IsImplThread());
1334 bool smoothness_takes_priority = 1334 bool smoothness_takes_priority =
1335 impl().layer_tree_host_impl->pinch_gesture_active() || 1335 impl().layer_tree_host_impl->pinch_gesture_active() ||
1336 impl().layer_tree_host_impl->page_scale_animation_active() || 1336 impl().layer_tree_host_impl->page_scale_animation_active() ||
1337 (impl().layer_tree_host_impl->IsCurrentlyScrolling() && 1337 impl().layer_tree_host_impl->IsCurrentlyScrolling();
1338 !impl().layer_tree_host_impl->scroll_affects_scroll_handler());
1339 1338
1340 // Schedule expiration if smoothness currently takes priority. 1339 // Schedule expiration if smoothness currently takes priority.
1341 if (smoothness_takes_priority) 1340 if (smoothness_takes_priority)
1342 impl().smoothness_priority_expiration_notifier.Schedule(); 1341 impl().smoothness_priority_expiration_notifier.Schedule();
1343 1342
1344 // We use the same priority for both trees by default. 1343 // We use the same priority for both trees by default.
1345 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; 1344 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES;
1346 1345
1347 // Smoothness takes priority if we have an expiration for it scheduled. 1346 // Smoothness takes priority if we have an expiration for it scheduled.
1348 if (impl().smoothness_priority_expiration_notifier.HasPendingNotification()) 1347 if (impl().smoothness_priority_expiration_notifier.HasPendingNotification())
1349 priority = SMOOTHNESS_TAKES_PRIORITY; 1348 priority = SMOOTHNESS_TAKES_PRIORITY;
1350 1349
1351 // New content always takes priority when the active tree has 1350 // New content always takes priority when the active tree has
1352 // evicted resources or there is an invalid viewport size. 1351 // evicted resources or there is an invalid viewport size.
1353 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || 1352 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() ||
1354 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || 1353 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() ||
1355 impl().layer_tree_host_impl->EvictedUIResourcesExist() || 1354 impl().layer_tree_host_impl->EvictedUIResourcesExist() ||
1356 impl().input_throttled_until_commit) { 1355 impl().input_throttled_until_commit) {
1357 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active 1356 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active
1358 // tree might be freed. We need to set RequiresHighResToDraw to ensure that 1357 // tree might be freed. We need to set RequiresHighResToDraw to ensure that
1359 // high res tiles will be required to activate pending tree. 1358 // high res tiles will be required to activate pending tree.
1360 impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw(); 1359 impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw();
1361 priority = NEW_CONTENT_TAKES_PRIORITY; 1360 priority = NEW_CONTENT_TAKES_PRIORITY;
1362 } 1361 }
1363 1362
1364 impl().layer_tree_host_impl->SetTreePriority(priority); 1363 impl().layer_tree_host_impl->SetTreePriority(priority);
1365 impl().scheduler->SetSmoothnessTakesPriority(priority == 1364
1366 SMOOTHNESS_TAKES_PRIORITY); 1365 // Only put the scheduler in impl latency prioritization mode if we don't
1366 // have a scroll listener. This gives the scroll listener a better chance of
1367 // handling scroll updates within the same frame. The tree itself is still
1368 // kept in prefer smoothness mode to allow checkerboarding.
1369 impl().scheduler->SetImplLatencyTakesPriority(
1370 priority == SMOOTHNESS_TAKES_PRIORITY &&
1371 !impl().layer_tree_host_impl->scroll_affects_scroll_handler());
1367 1372
1368 // Notify the the client of this compositor via the output surface. 1373 // Notify the the client of this compositor via the output surface.
1369 // TODO(epenner): Route this to compositor-thread instead of output-surface 1374 // TODO(epenner): Route this to compositor-thread instead of output-surface
1370 // after GTFO refactor of compositor-thread (http://crbug/170828). 1375 // after GTFO refactor of compositor-thread (http://crbug/170828).
1371 if (impl().layer_tree_host_impl->output_surface()) { 1376 if (impl().layer_tree_host_impl->output_surface()) {
1372 impl() 1377 impl()
1373 .layer_tree_host_impl->output_surface() 1378 .layer_tree_host_impl->output_surface()
1374 ->UpdateSmoothnessTakesPriority(priority == SMOOTHNESS_TAKES_PRIORITY); 1379 ->UpdateSmoothnessTakesPriority(priority == SMOOTHNESS_TAKES_PRIORITY);
1375 } 1380 }
1376 } 1381 }
(...skipping 20 matching lines...) Expand all
1397 1402
1398 impl().timing_history.DidActivateSyncTree(); 1403 impl().timing_history.DidActivateSyncTree();
1399 } 1404 }
1400 1405
1401 void ThreadProxy::DidManageTiles() { 1406 void ThreadProxy::DidManageTiles() {
1402 DCHECK(IsImplThread()); 1407 DCHECK(IsImplThread());
1403 impl().scheduler->DidManageTiles(); 1408 impl().scheduler->DidManageTiles();
1404 } 1409 }
1405 1410
1406 } // namespace cc 1411 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698