| 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_cache.h" | 5 #include "cc/tiles/gpu_image_decode_cache.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "cc/resources/resource_format_utils.h" | 22 #include "cc/resources/resource_format_utils.h" |
| 23 #include "cc/tiles/mipmap_util.h" | 23 #include "cc/tiles/mipmap_util.h" |
| 24 #include "gpu/command_buffer/client/context_support.h" | 24 #include "gpu/command_buffer/client/context_support.h" |
| 25 #include "gpu/command_buffer/client/gles2_interface.h" | 25 #include "gpu/command_buffer/client/gles2_interface.h" |
| 26 #include "gpu_image_decode_cache.h" | 26 #include "gpu_image_decode_cache.h" |
| 27 #include "skia/ext/texture_handle.h" | 27 #include "skia/ext/texture_handle.h" |
| 28 #include "third_party/skia/include/core/SkCanvas.h" | 28 #include "third_party/skia/include/core/SkCanvas.h" |
| 29 #include "third_party/skia/include/core/SkRefCnt.h" | 29 #include "third_party/skia/include/core/SkRefCnt.h" |
| 30 #include "third_party/skia/include/core/SkSurface.h" | 30 #include "third_party/skia/include/core/SkSurface.h" |
| 31 #include "third_party/skia/include/gpu/GrContext.h" | 31 #include "third_party/skia/include/gpu/GrContext.h" |
| 32 #include "third_party/skia/include/gpu/GrTexture.h" | |
| 33 #include "ui/gfx/skia_util.h" | 32 #include "ui/gfx/skia_util.h" |
| 34 #include "ui/gl/trace_util.h" | 33 #include "ui/gl/trace_util.h" |
| 35 | 34 |
| 36 namespace cc { | 35 namespace cc { |
| 37 namespace { | 36 namespace { |
| 38 | 37 |
| 39 // The number or entries to keep in the cache, depending on the memory state of | 38 // The number or entries to keep in the cache, depending on the memory state of |
| 40 // the system. This limit can be breached by in-use cache items, which cannot | 39 // the system. This limit can be breached by in-use cache items, which cannot |
| 41 // be deleted. | 40 // be deleted. |
| 42 static const int kNormalMaxItemsInCache = 2000; | 41 static const int kNormalMaxItemsInCache = 2000; |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 | 1272 |
| 1274 void GpuImageDecodeCache::OnPurgeMemory() { | 1273 void GpuImageDecodeCache::OnPurgeMemory() { |
| 1275 base::AutoLock lock(lock_); | 1274 base::AutoLock lock(lock_); |
| 1276 // Temporary changes |memory_state_| to free up cache as much as possible. | 1275 // Temporary changes |memory_state_| to free up cache as much as possible. |
| 1277 base::AutoReset<base::MemoryState> reset(&memory_state_, | 1276 base::AutoReset<base::MemoryState> reset(&memory_state_, |
| 1278 base::MemoryState::SUSPENDED); | 1277 base::MemoryState::SUSPENDED); |
| 1279 EnsureCapacity(0); | 1278 EnsureCapacity(0); |
| 1280 } | 1279 } |
| 1281 | 1280 |
| 1282 } // namespace cc | 1281 } // namespace cc |
| OLD | NEW |