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

Side by Side Diff: cc/tile_manager.cc

Issue 12260033: cc: Limit the total number of uploads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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 | « no previous file | 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 12 matching lines...) Expand all
23 23
24 // If we raster too fast we become upload bound, and pending 24 // If we raster too fast we become upload bound, and pending
25 // uploads consume memory. For maximum upload throughput, we would 25 // uploads consume memory. For maximum upload throughput, we would
26 // want to allow for upload_throughput * pipeline_time of pending 26 // want to allow for upload_throughput * pipeline_time of pending
27 // uploads, after which we are just wasting memory. Since we don't 27 // uploads, after which we are just wasting memory. Since we don't
28 // know our upload throughput yet, this just caps our memory usage. 28 // know our upload throughput yet, this just caps our memory usage.
29 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
30 // For reference, the Nexus10 can upload 1MB in about 2.5ms. 30 // For reference, the Nexus10 can upload 1MB in about 2.5ms.
31 // Assuming a three frame deep pipeline this implies ~20MB. 31 // Assuming a three frame deep pipeline this implies ~20MB.
32 const int kMaxPendingUploadBytes = 20 * 1024 * 1024; 32 const int kMaxPendingUploadBytes = 20 * 1024 * 1024;
33 // TODO(epenner): We should remove this upload limit (crbug.com/176197)
34 const int kMaxPendingUploads = 72;
33 #else 35 #else
34 const int kMaxPendingUploadBytes = 100 * 1024 * 1024; 36 const int kMaxPendingUploadBytes = 100 * 1024 * 1024;
37 const int kMaxPendingUploads = 1000;
35 #endif 38 #endif
36 39
37 // Determine bin based on three categories of tiles: things we need now, 40 // Determine bin based on three categories of tiles: things we need now,
38 // things we need soon, and eventually. 41 // things we need soon, and eventually.
39 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { 42 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
40 if (!prio.is_live) 43 if (!prio.is_live)
41 return NEVER_BIN; 44 return NEVER_BIN;
42 45
43 // The amount of time for which we want to have prepainting coverage. 46 // The amount of time for which we want to have prepainting coverage.
44 const double prepainting_window_time_seconds = 1.0; 47 const double prepainting_window_time_seconds = 1.0;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 DCHECK(managed_tile_state.can_be_freed); 626 DCHECK(managed_tile_state.can_be_freed);
624 if (managed_tile_state.resource) 627 if (managed_tile_state.resource)
625 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass()); 628 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass());
626 } 629 }
627 630
628 bool TileManager::CanDispatchRasterTask(Tile* tile) { 631 bool TileManager::CanDispatchRasterTask(Tile* tile) {
629 if (raster_worker_pool_->IsBusy()) 632 if (raster_worker_pool_->IsBusy())
630 return false; 633 return false;
631 size_t new_bytes_pending = bytes_pending_set_pixels_; 634 size_t new_bytes_pending = bytes_pending_set_pixels_;
632 new_bytes_pending += tile->bytes_consumed_if_allocated(); 635 new_bytes_pending += tile->bytes_consumed_if_allocated();
633 return new_bytes_pending <= kMaxPendingUploadBytes; 636 return new_bytes_pending <= kMaxPendingUploadBytes &&
637 tiles_with_pending_set_pixels_.size() < kMaxPendingUploads;
634 } 638 }
635 639
636 void TileManager::DispatchMoreTasks() { 640 void TileManager::DispatchMoreTasks() {
637 // Because tiles in the image decoding list have higher priorities, we 641 // Because tiles in the image decoding list have higher priorities, we
638 // need to process those tiles first before we start to handle the tiles 642 // need to process those tiles first before we start to handle the tiles
639 // in the need_to_be_rasterized queue. 643 // in the need_to_be_rasterized queue.
640 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); 644 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
641 it != tiles_with_image_decoding_tasks_.end(); ) { 645 it != tiles_with_image_decoding_tasks_.end(); ) {
642 DispatchImageDecodeTasksForTile(*it); 646 DispatchImageDecodeTasksForTile(*it);
643 ManagedTileState& managed_state = (*it)->managed_state(); 647 ManagedTileState& managed_state = (*it)->managed_state();
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 decode_begin_time = base::TimeTicks::Now(); 971 decode_begin_time = base::TimeTicks::Now();
968 pixel_ref->Decode(); 972 pixel_ref->Decode();
969 if (stats) { 973 if (stats) {
970 stats->totalDeferredImageDecodeCount++; 974 stats->totalDeferredImageDecodeCount++;
971 stats->totalDeferredImageDecodeTime += 975 stats->totalDeferredImageDecodeTime +=
972 base::TimeTicks::Now() - decode_begin_time; 976 base::TimeTicks::Now() - decode_begin_time;
973 } 977 }
974 } 978 }
975 979
976 } // namespace cc 980 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698