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

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: Only flush when not in smoothness/animations 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
« cc/resource_provider.cc ('K') | « 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 "IDLE_STATE")); 121 "IDLE_STATE"));
122 case WAITING_FOR_RASTER_STATE: 122 case WAITING_FOR_RASTER_STATE:
123 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 123 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
124 "WAITING_FOR_RASTER_STATE")); 124 "WAITING_FOR_RASTER_STATE"));
125 case RASTER_STATE: 125 case RASTER_STATE:
126 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 126 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
127 "RASTER_STATE")); 127 "RASTER_STATE"));
128 case UPLOAD_STATE: 128 case UPLOAD_STATE:
129 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 129 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
130 "UPLOAD_STATE")); 130 "UPLOAD_STATE"));
131 case UPLOAD_FLUSHED_STATE:
nduca 2013/03/11 19:41:47 I'm not sure I'm wild about flush as a term here.
Sami 2013/03/12 14:13:07 Agreed. I'll call it forced upload completion here
132 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
133 "UPLOAD_FLUSHED_STATE"));
131 default: 134 default:
132 DCHECK(false) << "Unrecognized TileRasterState value"; 135 DCHECK(false) << "Unrecognized TileRasterState value";
133 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 136 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
134 "<unknown TileRasterState value>")); 137 "<unknown TileRasterState value>"));
135 } 138 }
136 } 139 }
137 140
138 ManagedTileState::ManagedTileState() 141 ManagedTileState::ManagedTileState()
139 : can_use_gpu_memory(false), 142 : can_use_gpu_memory(false),
140 can_be_freed(true), 143 can_be_freed(true),
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 DidTileRasterStateChange(tile, IDLE_STATE); 455 DidTileRasterStateChange(tile, IDLE_STATE);
453 tiles_with_pending_upload_.pop(); 456 tiles_with_pending_upload_.pop();
454 } 457 }
455 } 458 }
456 459
457 void TileManager::DidCompleteFrame() { 460 void TileManager::DidCompleteFrame() {
458 allow_cheap_tasks_ = true; 461 allow_cheap_tasks_ = true;
459 did_schedule_cheap_tasks_ = false; 462 did_schedule_cheap_tasks_ = false;
460 } 463 }
461 464
465 void TileManager::FlushPendingTileUploadIfNeeded(Tile* tile) {
466 ManagedTileState& managed_tile_state = tile->managed_state();
467 if (managed_tile_state.raster_state == UPLOAD_STATE) {
468 DCHECK(managed_tile_state.resource);
469 Resource* resource = managed_tile_state.resource.get();
470 resource_pool_->resource_provider()->InsertWaitForSetPixels(resource->id());
471 managed_tile_state.resource_is_being_initialized = false;
472 DidTileRasterStateChange(tile, UPLOAD_FLUSHED_STATE);
473 }
474 }
475
462 void TileManager::GetMemoryStats( 476 void TileManager::GetMemoryStats(
463 size_t* memoryRequiredBytes, 477 size_t* memoryRequiredBytes,
464 size_t* memoryNiceToHaveBytes, 478 size_t* memoryNiceToHaveBytes,
465 size_t* memoryUsedBytes) const { 479 size_t* memoryUsedBytes) const {
466 *memoryRequiredBytes = 0; 480 *memoryRequiredBytes = 0;
467 *memoryNiceToHaveBytes = 0; 481 *memoryNiceToHaveBytes = 0;
468 *memoryUsedBytes = 0; 482 *memoryUsedBytes = 0;
469 for (size_t i = 0; i < live_or_allocated_tiles_.size(); i++) { 483 for (size_t i = 0; i < live_or_allocated_tiles_.size(); i++) {
470 const Tile* tile = live_or_allocated_tiles_[i]; 484 const Tile* tile = live_or_allocated_tiles_[i];
471 const ManagedTileState& mts = tile->managed_state(); 485 const ManagedTileState& mts = tile->managed_state();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { 551 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const {
538 // Always true when ManageTiles() call is pending. 552 // Always true when ManageTiles() call is pending.
539 if (manage_tiles_pending_) 553 if (manage_tiles_pending_)
540 return true; 554 return true;
541 555
542 for (int i = 0; i < NUM_STATES; ++i) { 556 for (int i = 0; i < NUM_STATES; ++i) {
543 switch (i) { 557 switch (i) {
544 case WAITING_FOR_RASTER_STATE: 558 case WAITING_FOR_RASTER_STATE:
545 case RASTER_STATE: 559 case RASTER_STATE:
546 case UPLOAD_STATE: 560 case UPLOAD_STATE:
561 case UPLOAD_FLUSHED_STATE:
547 for (int j = 0; j < NEVER_BIN; ++j) { 562 for (int j = 0; j < NEVER_BIN; ++j) {
548 if (raster_state_count_[i][tree][j]) 563 if (raster_state_count_[i][tree][j])
549 return true; 564 return true;
550 } 565 }
551 break; 566 break;
552 case IDLE_STATE: 567 case IDLE_STATE:
553 break; 568 break;
554 default: 569 default:
555 NOTREACHED(); 570 NOTREACHED();
556 } 571 }
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 decode_begin_time = base::TimeTicks::HighResNow(); 1115 decode_begin_time = base::TimeTicks::HighResNow();
1101 pixel_ref->Decode(); 1116 pixel_ref->Decode();
1102 if (stats) { 1117 if (stats) {
1103 stats->totalDeferredImageDecodeCount++; 1118 stats->totalDeferredImageDecodeCount++;
1104 stats->totalDeferredImageDecodeTime += 1119 stats->totalDeferredImageDecodeTime +=
1105 base::TimeTicks::HighResNow() - decode_begin_time; 1120 base::TimeTicks::HighResNow() - decode_begin_time;
1106 } 1121 }
1107 } 1122 }
1108 1123
1109 } // namespace cc 1124 } // namespace cc
OLDNEW
« cc/resource_provider.cc ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698