Chromium Code Reviews| 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/memory/discardable_memory_allocator.h" | 9 #include "base/memory/discardable_memory_allocator.h" |
|
jbauman
2016/09/15 23:08:34
#include "base/debug/alias.h"
cblume
2016/09/15 23:26:31
Done.
| |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/numerics/safe_math.h" | 12 #include "base/numerics/safe_math.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/trace_event/memory_dump_manager.h" | 15 #include "base/trace_event/memory_dump_manager.h" |
| 16 #include "cc/debug/devtools_instrumentation.h" | 16 #include "cc/debug/devtools_instrumentation.h" |
| 17 #include "cc/output/context_provider.h" | 17 #include "cc/output/context_provider.h" |
| 18 #include "cc/raster/tile_task.h" | 18 #include "cc/raster/tile_task.h" |
| 19 #include "cc/resources/resource_format_utils.h" | 19 #include "cc/resources/resource_format_utils.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 return; | 938 return; |
| 939 } | 939 } |
| 940 | 940 |
| 941 TRACE_EVENT0("cc", "GpuImageDecodeController::DecodeImage"); | 941 TRACE_EVENT0("cc", "GpuImageDecodeController::DecodeImage"); |
| 942 | 942 |
| 943 image_data->decode.ResetData(); | 943 image_data->decode.ResetData(); |
| 944 std::unique_ptr<base::DiscardableMemory> backing_memory; | 944 std::unique_ptr<base::DiscardableMemory> backing_memory; |
| 945 { | 945 { |
| 946 base::AutoUnlock unlock(lock_); | 946 base::AutoUnlock unlock(lock_); |
| 947 | 947 |
| 948 auto image_data_size = image_data->size; | |
| 949 base::debug::Alias(image_data_size); | |
|
jbauman
2016/09/15 23:08:34
I think you need &image_data_size
cblume
2016/09/15 23:26:31
Done. Sorry, my mind was elsewhere.
| |
| 948 backing_memory = base::DiscardableMemoryAllocator::GetInstance() | 950 backing_memory = base::DiscardableMemoryAllocator::GetInstance() |
| 949 ->AllocateLockedDiscardableMemory(image_data->size); | 951 ->AllocateLockedDiscardableMemory(image_data->size); |
| 950 CHECK(backing_memory); | |
| 951 | 952 |
| 952 switch (image_data->mode) { | 953 switch (image_data->mode) { |
| 953 case DecodedDataMode::CPU: { | 954 case DecodedDataMode::CPU: { |
| 954 SkImageInfo image_info = CreateImageInfoForDrawImage( | 955 SkImageInfo image_info = CreateImageInfoForDrawImage( |
| 955 draw_image, image_data->upload_scale_mip_level); | 956 draw_image, image_data->upload_scale_mip_level); |
| 956 // In order to match GPU scaling quality (which uses mip-maps at high | 957 // In order to match GPU scaling quality (which uses mip-maps at high |
| 957 // quality), we want to use at most medium filter quality for the | 958 // quality), we want to use at most medium filter quality for the |
| 958 // scale. | 959 // scale. |
| 959 SkPixmap image_pixmap(image_info, backing_memory->data(), | 960 SkPixmap image_pixmap(image_info, backing_memory->data(), |
| 960 image_info.minRowBytes()); | 961 image_info.minRowBytes()); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1168 bool GpuImageDecodeController::DiscardableIsLockedForTesting( | 1169 bool GpuImageDecodeController::DiscardableIsLockedForTesting( |
| 1169 const DrawImage& image) { | 1170 const DrawImage& image) { |
| 1170 base::AutoLock lock(lock_); | 1171 base::AutoLock lock(lock_); |
| 1171 auto found = persistent_cache_.Peek(image.image()->uniqueID()); | 1172 auto found = persistent_cache_.Peek(image.image()->uniqueID()); |
| 1172 DCHECK(found != persistent_cache_.end()); | 1173 DCHECK(found != persistent_cache_.end()); |
| 1173 ImageData* image_data = found->second.get(); | 1174 ImageData* image_data = found->second.get(); |
| 1174 return image_data->decode.is_locked(); | 1175 return image_data->decode.is_locked(); |
| 1175 } | 1176 } |
| 1176 | 1177 |
| 1177 } // namespace cc | 1178 } // namespace cc |
| OLD | NEW |