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

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 2654643004: cc: Fix missing ready to activate/draw callbacks. (Closed)
Patch Set: Created 3 years, 11 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/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 // If we have tiles left to raster for activation, and we don't allow 1202 // If we have tiles left to raster for activation, and we don't allow
1203 // activating without them, then skip activation and return early. 1203 // activating without them, then skip activation and return early.
1204 if (wait_for_all_required_tiles) 1204 if (wait_for_all_required_tiles)
1205 return; 1205 return;
1206 1206
1207 // Mark any required tiles that have not been been assigned memory after 1207 // Mark any required tiles that have not been been assigned memory after
1208 // reaching a steady memory state as OOM. This ensures that we activate/draw 1208 // reaching a steady memory state as OOM. This ensures that we activate/draw
1209 // even when OOM. Note that we can't reuse the queue we used for 1209 // even when OOM. Note that we can't reuse the queue we used for
1210 // AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call could have 1210 // AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call could have
1211 // evicted some tiles that would not be picked up by the old raster queue. 1211 // evicted some tiles that would not be picked up by the old raster queue.
1212 bool need_to_signal_activate = MarkTilesOutOfMemory(client_->BuildRasterQueue( 1212 MarkTilesOutOfMemory(client_->BuildRasterQueue(
1213 global_state_.tree_priority, 1213 global_state_.tree_priority,
1214 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); 1214 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
1215 bool need_to_signal_draw = MarkTilesOutOfMemory(client_->BuildRasterQueue( 1215 MarkTilesOutOfMemory(client_->BuildRasterQueue(
1216 global_state_.tree_priority, 1216 global_state_.tree_priority,
1217 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); 1217 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW));
1218 1218
1219 // TODO(vmpstr): Temporary check to debug crbug.com/642927. 1219 // TODO(vmpstr): Temporary check to debug crbug.com/642927.
1220 CHECK(tile_task_manager_); 1220 CHECK(tile_task_manager_);
1221
1221 DCHECK(IsReadyToActivate()); 1222 DCHECK(IsReadyToActivate());
1222 DCHECK(IsReadyToDraw()); 1223 DCHECK(IsReadyToDraw());
1223 signals_.ready_to_activate = need_to_signal_activate; 1224 signals_.ready_to_activate = true;
1224 signals_.ready_to_draw = need_to_signal_draw; 1225 signals_.ready_to_draw = true;
1225 // TODO(ericrk): Investigate why we need to schedule this (not just call it 1226 // TODO(ericrk): Investigate why we need to schedule this (not just call it
1226 // inline). http://crbug.com/498439 1227 // inline). http://crbug.com/498439
1227 signals_check_notifier_.Schedule(); 1228 signals_check_notifier_.Schedule();
1228 } 1229 }
1229 1230
1230 bool TileManager::MarkTilesOutOfMemory( 1231 void TileManager::MarkTilesOutOfMemory(
1231 std::unique_ptr<RasterTilePriorityQueue> queue) const { 1232 std::unique_ptr<RasterTilePriorityQueue> queue) const {
1232 // Mark required tiles as OOM so that we can activate/draw without them. 1233 // Mark required tiles as OOM so that we can activate/draw without them.
1233 if (queue->IsEmpty())
1234 return false;
1235
1236 for (; !queue->IsEmpty(); queue->Pop()) { 1234 for (; !queue->IsEmpty(); queue->Pop()) {
1237 Tile* tile = queue->Top().tile(); 1235 Tile* tile = queue->Top().tile();
1238 if (tile->draw_info().IsReadyToDraw()) 1236 if (tile->draw_info().IsReadyToDraw())
1239 continue; 1237 continue;
1240 tile->draw_info().set_oom(); 1238 tile->draw_info().set_oom();
1241 client_->NotifyTileStateChanged(tile); 1239 client_->NotifyTileStateChanged(tile);
1242 } 1240 }
1243 return true;
1244 } 1241 }
1245 1242
1246 ResourceFormat TileManager::DetermineResourceFormat(const Tile* tile) const { 1243 ResourceFormat TileManager::DetermineResourceFormat(const Tile* tile) const {
1247 return raster_buffer_provider_->GetResourceFormat(!tile->is_opaque()); 1244 return raster_buffer_provider_->GetResourceFormat(!tile->is_opaque());
1248 } 1245 }
1249 1246
1250 bool TileManager::DetermineResourceRequiresSwizzle(const Tile* tile) const { 1247 bool TileManager::DetermineResourceRequiresSwizzle(const Tile* tile) const {
1251 return raster_buffer_provider_->IsResourceSwizzleRequired(!tile->is_opaque()); 1248 return raster_buffer_provider_->IsResourceSwizzleRequired(!tile->is_opaque());
1252 } 1249 }
1253 1250
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 all_tile_tasks_completed = false; 1350 all_tile_tasks_completed = false;
1354 did_notify_all_tile_tasks_completed = false; 1351 did_notify_all_tile_tasks_completed = false;
1355 } 1352 }
1356 1353
1357 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1354 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1358 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1355 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1359 PrioritizedWorkToSchedule&& other) = default; 1356 PrioritizedWorkToSchedule&& other) = default;
1360 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1357 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1361 1358
1362 } // namespace cc 1359 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698