| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 ->fID; | 643 ->fID; |
| 644 MemoryAllocatorDumpGuid guid = gl::GetGLTextureClientGUIDForTracing( | 644 MemoryAllocatorDumpGuid guid = gl::GetGLTextureClientGUIDForTracing( |
| 645 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); | 645 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); |
| 646 | 646 |
| 647 // kImportance is somewhat arbitrary - we chose 3 to be higher than the | 647 // kImportance is somewhat arbitrary - we chose 3 to be higher than the |
| 648 // value used in the GPU process (1), and Skia (2), causing us to appear | 648 // value used in the GPU process (1), and Skia (2), causing us to appear |
| 649 // as the owner in memory traces. | 649 // as the owner in memory traces. |
| 650 const int kImportance = 3; | 650 const int kImportance = 3; |
| 651 pmd->CreateSharedGlobalAllocatorDump(guid); | 651 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 652 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 652 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 653 // TODO(hajimehoshi): |image_data::data_| might be allocated in |
| 654 // DiscardableSharedMemory. Get shared memory handle of that and call |
| 655 // base::SharedMemoryDumpProvider::AddOwnershipEdgeToSharedGlobalDump here |
| 653 } | 656 } |
| 654 } | 657 } |
| 655 | 658 |
| 656 return true; | 659 return true; |
| 657 } | 660 } |
| 658 | 661 |
| 659 void GpuImageDecodeCache::DecodeImage(const DrawImage& draw_image) { | 662 void GpuImageDecodeCache::DecodeImage(const DrawImage& draw_image) { |
| 660 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 663 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 661 "GpuImageDecodeCache::DecodeImage"); | 664 "GpuImageDecodeCache::DecodeImage"); |
| 662 base::AutoLock lock(lock_); | 665 base::AutoLock lock(lock_); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1275 |
| 1273 void GpuImageDecodeCache::OnPurgeMemory() { | 1276 void GpuImageDecodeCache::OnPurgeMemory() { |
| 1274 base::AutoLock lock(lock_); | 1277 base::AutoLock lock(lock_); |
| 1275 // Temporary changes |memory_state_| to free up cache as much as possible. | 1278 // Temporary changes |memory_state_| to free up cache as much as possible. |
| 1276 base::AutoReset<base::MemoryState> reset(&memory_state_, | 1279 base::AutoReset<base::MemoryState> reset(&memory_state_, |
| 1277 base::MemoryState::SUSPENDED); | 1280 base::MemoryState::SUSPENDED); |
| 1278 EnsureCapacity(0); | 1281 EnsureCapacity(0); |
| 1279 } | 1282 } |
| 1280 | 1283 |
| 1281 } // namespace cc | 1284 } // namespace cc |
| OLD | NEW |