Skip to content

Commit

Permalink
cc: Reorder TileManager shutdown and add debugging information.
Browse files Browse the repository at this point in the history
This patch changes the order of shutdown from clearing orphans then
completing tasks to first complete the tasks then clean orphans, since
task completion causes more orphans to be generated.

Also, this adds debugging information to ImageManager to narrow down
the time when crash in the referenced bug happens.

R=ericrk@chromium.org
BUG=650234
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://codereview.chromium.org/2365303003
Cr-Commit-Position: refs/heads/master@{#421261}
  • Loading branch information
vmpstr authored and Commit bot committed Sep 27, 2016
1 parent c29e68c commit 63faa3a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions cc/tiles/image_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ ImageManager::~ImageManager() = default;

void ImageManager::SetImageDecodeController(ImageDecodeController* controller) {
// We can only switch from null to non-null and back.
DCHECK(controller || controller_);
DCHECK(!controller || !controller_);
// CHECK to debug crbug.com/650234.
CHECK(controller || controller_);
CHECK(!controller || !controller_);

if (!controller) {
SetPredecodeImages(std::vector<DrawImage>(),
ImageDecodeController::TracingInfo());
}
controller_ = controller;
// Debugging information for crbug.com/650234.
++num_times_controller_was_set_;
}

void ImageManager::GetTasksForImagesAndRef(
Expand All @@ -41,7 +44,8 @@ void ImageManager::GetTasksForImagesAndRef(
}

void ImageManager::UnrefImages(const std::vector<DrawImage>& images) {
DCHECK(controller_);
// Debugging information for crbug.com/650234.
CHECK(controller_) << num_times_controller_was_set_;
for (auto image : images)
controller_->UnrefImage(image);
}
Expand Down
3 changes: 3 additions & 0 deletions cc/tiles/image_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class CC_EXPORT ImageManager {
ImageDecodeController* controller_ = nullptr;
std::vector<DrawImage> predecode_locked_images_;

// Debugging information for crbug.com/650234.
size_t num_times_controller_was_set_ = 0;

DISALLOW_COPY_AND_ASSIGN(ImageManager);
};

Expand Down
4 changes: 2 additions & 2 deletions cc/tiles/tile_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ void TileManager::FinishTasksAndCleanUp() {

raster_buffer_provider_->Shutdown();

tile_task_manager_->CheckForCompletedTasks();

// Now that all tasks have been finished, we can clear any |orphan_tasks_|.
orphan_tasks_.clear();

tile_task_manager_->CheckForCompletedTasks();

FreeResourcesForReleasedTiles();
CleanUpReleasedTiles();

Expand Down

0 comments on commit 63faa3a

Please sign in to comment.