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

Side by Side Diff: cc/tile_manager.cc

Issue 12321053: cc: Complete pending tile uploads if they are needed for tree activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased after managed_tile_state refactoring. Created 7 years, 9 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
« no previous file with comments | « cc/tile_manager.h ('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 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/tile_manager.h" 5 #include "cc/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 "IDLE_STATE")); 130 "IDLE_STATE"));
131 case WAITING_FOR_RASTER_STATE: 131 case WAITING_FOR_RASTER_STATE:
132 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 132 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
133 "WAITING_FOR_RASTER_STATE")); 133 "WAITING_FOR_RASTER_STATE"));
134 case RASTER_STATE: 134 case RASTER_STATE:
135 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 135 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
136 "RASTER_STATE")); 136 "RASTER_STATE"));
137 case UPLOAD_STATE: 137 case UPLOAD_STATE:
138 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 138 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
139 "UPLOAD_STATE")); 139 "UPLOAD_STATE"));
140 case FORCED_UPLOAD_COMPLETION_STATE:
141 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
142 "FORCED_UPLOAD_COMPLETION_STATE"));
140 default: 143 default:
141 DCHECK(false) << "Unrecognized TileRasterState value"; 144 DCHECK(false) << "Unrecognized TileRasterState value";
142 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 145 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
143 "<unknown TileRasterState value>")); 146 "<unknown TileRasterState value>"));
144 } 147 }
145 } 148 }
146 149
147 TileManager::TileManager( 150 TileManager::TileManager(
148 TileManagerClient* client, 151 TileManagerClient* client,
149 ResourceProvider* resource_provider, 152 ResourceProvider* resource_provider,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 DidTileRasterStateChange(tile, IDLE_STATE); 424 DidTileRasterStateChange(tile, IDLE_STATE);
422 tiles_with_pending_upload_.pop(); 425 tiles_with_pending_upload_.pop();
423 } 426 }
424 } 427 }
425 428
426 void TileManager::DidCompleteFrame() { 429 void TileManager::DidCompleteFrame() {
427 allow_cheap_tasks_ = true; 430 allow_cheap_tasks_ = true;
428 did_schedule_cheap_tasks_ = false; 431 did_schedule_cheap_tasks_ = false;
429 } 432 }
430 433
434 void TileManager::ForceTileUploadToComplete(Tile* tile) {
435 ManagedTileState& managed_tile_state = tile->managed_state();
436 if (managed_tile_state.raster_state == UPLOAD_STATE) {
437 Resource* resource = tile->drawing_info().resource_.get();
438 DCHECK(resource);
439 resource_pool_->resource_provider()->
440 ForceSetPixelsToComplete(resource->id());
441 tile->drawing_info().resource_is_being_initialized_ = false;
442 DidTileRasterStateChange(tile, FORCED_UPLOAD_COMPLETION_STATE);
443 }
444 }
445
431 void TileManager::GetMemoryStats( 446 void TileManager::GetMemoryStats(
432 size_t* memoryRequiredBytes, 447 size_t* memoryRequiredBytes,
433 size_t* memoryNiceToHaveBytes, 448 size_t* memoryNiceToHaveBytes,
434 size_t* memoryUsedBytes) const { 449 size_t* memoryUsedBytes) const {
435 *memoryRequiredBytes = 0; 450 *memoryRequiredBytes = 0;
436 *memoryNiceToHaveBytes = 0; 451 *memoryNiceToHaveBytes = 0;
437 *memoryUsedBytes = 0; 452 *memoryUsedBytes = 0;
438 for (size_t i = 0; i < live_or_allocated_tiles_.size(); i++) { 453 for (size_t i = 0; i < live_or_allocated_tiles_.size(); i++) {
439 const Tile* tile = live_or_allocated_tiles_[i]; 454 const Tile* tile = live_or_allocated_tiles_[i];
440 const ManagedTileState& mts = tile->managed_state(); 455 const ManagedTileState& mts = tile->managed_state();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { 521 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const {
507 // Always true when ManageTiles() call is pending. 522 // Always true when ManageTiles() call is pending.
508 if (manage_tiles_pending_) 523 if (manage_tiles_pending_)
509 return true; 524 return true;
510 525
511 for (int i = 0; i < NUM_STATES; ++i) { 526 for (int i = 0; i < NUM_STATES; ++i) {
512 switch (i) { 527 switch (i) {
513 case WAITING_FOR_RASTER_STATE: 528 case WAITING_FOR_RASTER_STATE:
514 case RASTER_STATE: 529 case RASTER_STATE:
515 case UPLOAD_STATE: 530 case UPLOAD_STATE:
531 case FORCED_UPLOAD_COMPLETION_STATE:
516 for (int j = 0; j < NEVER_BIN; ++j) { 532 for (int j = 0; j < NEVER_BIN; ++j) {
517 if (raster_state_count_[i][tree][j]) 533 if (raster_state_count_[i][tree][j])
518 return true; 534 return true;
519 } 535 }
520 break; 536 break;
521 case IDLE_STATE: 537 case IDLE_STATE:
522 break; 538 break;
523 default: 539 default:
524 NOTREACHED(); 540 NOTREACHED();
525 } 541 }
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 decode_begin_time = base::TimeTicks::HighResNow(); 1106 decode_begin_time = base::TimeTicks::HighResNow();
1091 pixel_ref->Decode(); 1107 pixel_ref->Decode();
1092 if (stats) { 1108 if (stats) {
1093 stats->totalDeferredImageDecodeCount++; 1109 stats->totalDeferredImageDecodeCount++;
1094 stats->totalDeferredImageDecodeTime += 1110 stats->totalDeferredImageDecodeTime +=
1095 base::TimeTicks::HighResNow() - decode_begin_time; 1111 base::TimeTicks::HighResNow() - decode_begin_time;
1096 } 1112 }
1097 } 1113 }
1098 1114
1099 } // namespace cc 1115 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698