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 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 // of this could be that this tile is no longer allowed to use gpu | 807 // of this could be that this tile is no longer allowed to use gpu |
808 // memory and in that case we need to abort initialization and free all | 808 // memory and in that case we need to abort initialization and free all |
809 // associated resources before calling DispatchMoreTasks(). | 809 // associated resources before calling DispatchMoreTasks(). |
810 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) | 810 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) |
811 AssignGpuMemoryToTiles(); | 811 AssignGpuMemoryToTiles(); |
812 | 812 |
813 ManagedTileState& managed_tile_state = tile->managed_state(); | 813 ManagedTileState& managed_tile_state = tile->managed_state(); |
814 | 814 |
815 // Finish resource initialization if |can_use_gpu_memory| is true. | 815 // Finish resource initialization if |can_use_gpu_memory| is true. |
816 if (managed_tile_state.can_use_gpu_memory) { | 816 if (managed_tile_state.can_use_gpu_memory) { |
817 | |
818 // Tile resources can't be freed until upload has completed. | 817 // Tile resources can't be freed until upload has completed. |
819 tile->drawing_info().can_be_freed_ = false; | 818 tile->drawing_info().can_be_freed_ = false; |
820 | 819 |
821 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); | 820 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); |
822 has_performed_uploads_since_last_flush_ = true; | 821 has_performed_uploads_since_last_flush_ = true; |
823 | 822 |
824 tile->drawing_info().resource_ = resource.Pass(); | 823 tile->drawing_info().resource_ = resource.Pass(); |
825 | 824 |
826 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); | 825 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); |
827 tiles_with_pending_upload_.push(tile); | 826 tiles_with_pending_upload_.push(tile); |
(...skipping 13 matching lines...) Expand all Loading... |
841 void TileManager::DidTileTreeBinChange(Tile* tile, | 840 void TileManager::DidTileTreeBinChange(Tile* tile, |
842 TileManagerBin new_tree_bin, | 841 TileManagerBin new_tree_bin, |
843 WhichTree tree) { | 842 WhichTree tree) { |
844 ManagedTileState& mts = tile->managed_state(); | 843 ManagedTileState& mts = tile->managed_state(); |
845 mts.tree_bin[tree] = new_tree_bin; | 844 mts.tree_bin[tree] = new_tree_bin; |
846 } | 845 } |
847 | 846 |
848 // static | 847 // static |
849 void TileManager::RunRasterTask( | 848 void TileManager::RunRasterTask( |
850 uint8* buffer, | 849 uint8* buffer, |
851 const gfx::Rect& rect, | 850 gfx::Rect rect, |
852 float contents_scale, | 851 float contents_scale, |
853 const RasterTaskMetadata& metadata, | 852 const RasterTaskMetadata& metadata, |
854 RenderingStatsInstrumentation* stats_instrumentation, | 853 RenderingStatsInstrumentation* stats_instrumentation, |
855 PicturePileImpl* picture_pile) { | 854 PicturePileImpl* picture_pile) { |
856 TRACE_EVENT2( | 855 TRACE_EVENT2( |
857 "cc", "TileManager::RunRasterTask", | 856 "cc", "TileManager::RunRasterTask", |
858 "is_on_pending_tree", | 857 "is_on_pending_tree", |
859 metadata.is_tile_in_pending_tree_now_bin, | 858 metadata.is_tile_in_pending_tree_now_bin, |
860 "is_low_res", | 859 "is_low_res", |
861 metadata.tile_resolution == LOW_RESOLUTION); | 860 metadata.tile_resolution == LOW_RESOLUTION); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 skia::LazyPixelRef* pixel_ref, | 975 skia::LazyPixelRef* pixel_ref, |
977 RenderingStatsInstrumentation* stats_instrumentation) { | 976 RenderingStatsInstrumentation* stats_instrumentation) { |
978 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 977 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
979 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 978 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
980 pixel_ref->Decode(); | 979 pixel_ref->Decode(); |
981 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 980 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
982 stats_instrumentation->AddDeferredImageDecode(duration); | 981 stats_instrumentation->AddDeferredImageDecode(duration); |
983 } | 982 } |
984 | 983 |
985 } // namespace cc | 984 } // namespace cc |
OLD | NEW |