OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tiles/gpu_image_decode_controller.h" | 5 #include "cc/tiles/gpu_image_decode_controller.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/memory/discardable_memory_allocator.h" | 10 #include "base/memory/discardable_memory_allocator.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 return; | 936 return; |
937 } | 937 } |
938 | 938 |
939 TRACE_EVENT0("cc", "GpuImageDecodeController::DecodeImage"); | 939 TRACE_EVENT0("cc", "GpuImageDecodeController::DecodeImage"); |
940 | 940 |
941 image_data->decode.ResetData(); | 941 image_data->decode.ResetData(); |
942 std::unique_ptr<base::DiscardableMemory> backing_memory; | 942 std::unique_ptr<base::DiscardableMemory> backing_memory; |
943 { | 943 { |
944 base::AutoUnlock unlock(lock_); | 944 base::AutoUnlock unlock(lock_); |
945 | 945 |
946 size_t image_data_size = image_data->size; | |
947 base::debug::Alias(&image_data_size); | |
948 backing_memory = base::DiscardableMemoryAllocator::GetInstance() | 946 backing_memory = base::DiscardableMemoryAllocator::GetInstance() |
949 ->AllocateLockedDiscardableMemory(image_data_size); | 947 ->AllocateLockedDiscardableMemory(image_data->size); |
950 | 948 |
951 switch (image_data->mode) { | 949 switch (image_data->mode) { |
952 case DecodedDataMode::CPU: { | 950 case DecodedDataMode::CPU: { |
953 SkImageInfo image_info = CreateImageInfoForDrawImage( | 951 SkImageInfo image_info = CreateImageInfoForDrawImage( |
954 draw_image, image_data->upload_scale_mip_level); | 952 draw_image, image_data->upload_scale_mip_level); |
955 // In order to match GPU scaling quality (which uses mip-maps at high | 953 // In order to match GPU scaling quality (which uses mip-maps at high |
956 // quality), we want to use at most medium filter quality for the | 954 // quality), we want to use at most medium filter quality for the |
957 // scale. | 955 // scale. |
958 SkPixmap image_pixmap(image_info, backing_memory->data(), | 956 SkPixmap image_pixmap(image_info, backing_memory->data(), |
959 image_info.minRowBytes()); | 957 image_info.minRowBytes()); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 // TODO(tasak): free this component's caches as much as possible before | 1178 // TODO(tasak): free this component's caches as much as possible before |
1181 // suspending renderer. | 1179 // suspending renderer. |
1182 break; | 1180 break; |
1183 case base::MemoryState::UNKNOWN: | 1181 case base::MemoryState::UNKNOWN: |
1184 // NOT_REACHED. | 1182 // NOT_REACHED. |
1185 break; | 1183 break; |
1186 } | 1184 } |
1187 } | 1185 } |
1188 | 1186 |
1189 } // namespace cc | 1187 } // namespace cc |
OLD | NEW |