OLD | NEW |
---|---|
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/resources/tile_manager.h" | 5 #include "cc/resources/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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 | 589 |
590 size_t bytes_allocatable = | 590 size_t bytes_allocatable = |
591 global_state_.memory_limit_in_bytes - unreleasable_bytes; | 591 global_state_.memory_limit_in_bytes - unreleasable_bytes; |
592 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; | 592 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; |
593 size_t bytes_left = bytes_allocatable; | 593 size_t bytes_left = bytes_allocatable; |
594 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); | 594 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); |
595 it != live_or_allocated_tiles_.end(); | 595 it != live_or_allocated_tiles_.end(); |
596 ++it) { | 596 ++it) { |
597 Tile* tile = *it; | 597 Tile* tile = *it; |
598 ManagedTileState& mts = tile->managed_state(); | 598 ManagedTileState& mts = tile->managed_state(); |
599 if (!tile->drawing_info().requires_resource()) | 599 if (!tile->drawing_info().requires_resource()) |
nduca
2013/03/21 02:22:48
@vmpstr: why do we sometimes say tile->drawing inf
vmpstr
2013/03/21 16:34:11
Yeah that should be fixed. I prefer using tile->dr
| |
600 continue; | 600 continue; |
601 | 601 |
602 size_t tile_bytes = tile->bytes_consumed_if_allocated(); | 602 size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
603 if (!mts.drawing_info.can_be_freed_) | 603 if (!mts.drawing_info.can_be_freed_) |
604 continue; | 604 continue; |
605 if (mts.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && | 605 if (mts.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && |
606 mts.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { | 606 mts.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { |
607 mts.can_use_gpu_memory = false; | 607 mts.can_use_gpu_memory = false; |
608 FreeResourcesForTile(tile); | 608 FreeResourcesForTile(tile); |
609 continue; | 609 continue; |
610 } | 610 } |
611 if (tile_bytes > bytes_left) { | 611 if (tile_bytes > bytes_left) { |
612 mts.can_use_gpu_memory = false; | 612 mts.can_use_gpu_memory = false; |
613 if (mts.bin[HIGH_PRIORITY_BIN] == NOW_BIN || | 613 if (mts.bin[HIGH_PRIORITY_BIN] == NOW_BIN || |
614 mts.bin[LOW_PRIORITY_BIN] == NOW_BIN) | 614 mts.bin[LOW_PRIORITY_BIN] == NOW_BIN) |
615 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; | 615 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; |
616 FreeResourcesForTile(tile); | 616 FreeResourcesForTile(tile); |
nduca
2013/03/21 02:22:48
so um, where is the part of this loop that says "p
Leandro Graciá Gil
2013/03/21 03:35:50
I don't see any specific consequences of that. If
vmpstr
2013/03/21 16:34:11
If tile->drawing_info().mode() is set to PICTURE_P
Leandro Graciá Gil
2013/03/21 16:42:48
I see your point. Fixed.
| |
617 tile->drawing_info().set_rasterize_on_demand(); | |
617 continue; | 618 continue; |
618 } | 619 } |
619 bytes_left -= tile_bytes; | 620 bytes_left -= tile_bytes; |
620 mts.can_use_gpu_memory = true; | 621 mts.can_use_gpu_memory = true; |
621 if (!mts.drawing_info.resource_ && | 622 if (!mts.drawing_info.resource_ && |
622 !mts.drawing_info.resource_is_being_initialized_) { | 623 !mts.drawing_info.resource_is_being_initialized_) { |
623 tiles_that_need_to_be_rasterized_.push_back(tile); | 624 tiles_that_need_to_be_rasterized_.push_back(tile); |
624 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); | 625 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); |
625 } | 626 } |
626 } | 627 } |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 decode_begin_time = base::TimeTicks::HighResNow(); | 1116 decode_begin_time = base::TimeTicks::HighResNow(); |
1116 pixel_ref->Decode(); | 1117 pixel_ref->Decode(); |
1117 if (stats) { | 1118 if (stats) { |
1118 stats->totalDeferredImageDecodeCount++; | 1119 stats->totalDeferredImageDecodeCount++; |
1119 stats->totalDeferredImageDecodeTime += | 1120 stats->totalDeferredImageDecodeTime += |
1120 base::TimeTicks::HighResNow() - decode_begin_time; | 1121 base::TimeTicks::HighResNow() - decode_begin_time; |
1121 } | 1122 } |
1122 } | 1123 } |
1123 | 1124 |
1124 } // namespace cc | 1125 } // namespace cc |
OLD | NEW |