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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 *main_frame_will_happen = false; | 1320 *main_frame_will_happen = false; |
1321 } | 1321 } |
1322 completion->Signal(); | 1322 completion->Signal(); |
1323 } | 1323 } |
1324 | 1324 |
1325 void ThreadProxy::RenewTreePriority() { | 1325 void ThreadProxy::RenewTreePriority() { |
1326 DCHECK(IsImplThread()); | 1326 DCHECK(IsImplThread()); |
1327 bool smoothness_takes_priority = | 1327 bool smoothness_takes_priority = |
1328 impl().layer_tree_host_impl->pinch_gesture_active() || | 1328 impl().layer_tree_host_impl->pinch_gesture_active() || |
1329 impl().layer_tree_host_impl->page_scale_animation_active() || | 1329 impl().layer_tree_host_impl->page_scale_animation_active() || |
1330 (impl().layer_tree_host_impl->IsCurrentlyScrolling() && | 1330 impl().layer_tree_host_impl->IsCurrentlyScrolling(); |
1331 !impl().layer_tree_host_impl->scroll_affects_scroll_handler()); | |
1332 | 1331 |
1333 // Schedule expiration if smoothness currently takes priority. | 1332 // Schedule expiration if smoothness currently takes priority. |
1334 if (smoothness_takes_priority) | 1333 if (smoothness_takes_priority) |
1335 impl().smoothness_priority_expiration_notifier.Schedule(); | 1334 impl().smoothness_priority_expiration_notifier.Schedule(); |
1336 | 1335 |
1337 // We use the same priority for both trees by default. | 1336 // We use the same priority for both trees by default. |
1338 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; | 1337 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; |
1339 | 1338 |
1340 // Smoothness takes priority if we have an expiration for it scheduled. | 1339 // Smoothness takes priority if we have an expiration for it scheduled. |
1341 if (impl().smoothness_priority_expiration_notifier.HasPendingNotification()) | 1340 if (impl().smoothness_priority_expiration_notifier.HasPendingNotification()) |
1342 priority = SMOOTHNESS_TAKES_PRIORITY; | 1341 priority = SMOOTHNESS_TAKES_PRIORITY; |
1343 | 1342 |
1344 // New content always takes priority when the active tree has | 1343 // New content always takes priority when the active tree has |
1345 // evicted resources or there is an invalid viewport size. | 1344 // evicted resources or there is an invalid viewport size. |
1346 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || | 1345 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || |
1347 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || | 1346 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || |
1348 impl().layer_tree_host_impl->EvictedUIResourcesExist() || | 1347 impl().layer_tree_host_impl->EvictedUIResourcesExist() || |
1349 impl().input_throttled_until_commit) { | 1348 impl().input_throttled_until_commit) { |
1350 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active | 1349 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active |
1351 // tree might be freed. We need to set RequiresHighResToDraw to ensure that | 1350 // tree might be freed. We need to set RequiresHighResToDraw to ensure that |
1352 // high res tiles will be required to activate pending tree. | 1351 // high res tiles will be required to activate pending tree. |
1353 impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw(); | 1352 impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw(); |
1354 priority = NEW_CONTENT_TAKES_PRIORITY; | 1353 priority = NEW_CONTENT_TAKES_PRIORITY; |
1355 } | 1354 } |
1356 | 1355 |
1357 impl().layer_tree_host_impl->SetTreePriority(priority); | 1356 impl().layer_tree_host_impl->SetTreePriority(priority); |
1358 impl().scheduler->SetSmoothnessTakesPriority(priority == | 1357 |
1359 SMOOTHNESS_TAKES_PRIORITY); | 1358 // Only put the scheduler in prefer_smoothness_mode if we don't have a scroll |
1359 // listener. This gives the scroll listener a better chance of handling | |
1360 // scroll updates within the same frame. The tree itself is still kept in | |
1361 // prefer smoothness mode to allow checkerboarding. | |
1362 impl().scheduler->SetSmoothnessTakesPriority( | |
brianderson
2014/09/03 20:01:57
Should we rename the concept in the scheduler sinc
| |
1363 priority == SMOOTHNESS_TAKES_PRIORITY && | |
1364 !impl().layer_tree_host_impl->scroll_affects_scroll_handler()); | |
1360 | 1365 |
1361 // Notify the the client of this compositor via the output surface. | 1366 // Notify the the client of this compositor via the output surface. |
1362 // TODO(epenner): Route this to compositor-thread instead of output-surface | 1367 // TODO(epenner): Route this to compositor-thread instead of output-surface |
1363 // after GTFO refactor of compositor-thread (http://crbug/170828). | 1368 // after GTFO refactor of compositor-thread (http://crbug/170828). |
1364 if (impl().layer_tree_host_impl->output_surface()) { | 1369 if (impl().layer_tree_host_impl->output_surface()) { |
1365 impl() | 1370 impl() |
1366 .layer_tree_host_impl->output_surface() | 1371 .layer_tree_host_impl->output_surface() |
1367 ->UpdateSmoothnessTakesPriority(priority == SMOOTHNESS_TAKES_PRIORITY); | 1372 ->UpdateSmoothnessTakesPriority(priority == SMOOTHNESS_TAKES_PRIORITY); |
1368 } | 1373 } |
1369 } | 1374 } |
(...skipping 20 matching lines...) Expand all Loading... | |
1390 | 1395 |
1391 impl().timing_history.DidActivateSyncTree(); | 1396 impl().timing_history.DidActivateSyncTree(); |
1392 } | 1397 } |
1393 | 1398 |
1394 void ThreadProxy::DidManageTiles() { | 1399 void ThreadProxy::DidManageTiles() { |
1395 DCHECK(IsImplThread()); | 1400 DCHECK(IsImplThread()); |
1396 impl().scheduler->DidManageTiles(); | 1401 impl().scheduler->DidManageTiles(); |
1397 } | 1402 } |
1398 | 1403 |
1399 } // namespace cc | 1404 } // namespace cc |
OLD | NEW |