Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: cc/tiles/gpu_image_decode_cache.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Address on primiano's review Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 ->fID; 612 ->fID;
613 MemoryAllocatorDumpGuid guid = gl::GetGLTextureClientGUIDForTracing( 613 MemoryAllocatorDumpGuid guid = gl::GetGLTextureClientGUIDForTracing(
614 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); 614 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id);
615 615
616 // kImportance is somewhat arbitrary - we chose 3 to be higher than the 616 // kImportance is somewhat arbitrary - we chose 3 to be higher than the
617 // value used in the GPU process (1), and Skia (2), causing us to appear 617 // value used in the GPU process (1), and Skia (2), causing us to appear
618 // as the owner in memory traces. 618 // as the owner in memory traces.
619 const int kImportance = 3; 619 const int kImportance = 3;
620 pmd->CreateSharedGlobalAllocatorDump(guid); 620 pmd->CreateSharedGlobalAllocatorDump(guid);
621 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 621 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
622 // TODO(hajimehoshi): |image_data::data_| might be allocated in
623 // DiscardableSharedMemory. Get shared memory handle of that and call
624 // base::SharedMemoryDumpProvider::AddOwnershipEdgeToSharedGlobalDump here
622 } 625 }
623 } 626 }
624 627
625 return true; 628 return true;
626 } 629 }
627 630
628 void GpuImageDecodeCache::DecodeImage(const DrawImage& draw_image) { 631 void GpuImageDecodeCache::DecodeImage(const DrawImage& draw_image) {
629 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 632 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
630 "GpuImageDecodeCache::DecodeImage"); 633 "GpuImageDecodeCache::DecodeImage");
631 base::AutoLock lock(lock_); 634 base::AutoLock lock(lock_);
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 EnsureCapacity(0); 1234 EnsureCapacity(0);
1232 break; 1235 break;
1233 } 1236 }
1234 case base::MemoryState::UNKNOWN: 1237 case base::MemoryState::UNKNOWN:
1235 // NOT_REACHED. 1238 // NOT_REACHED.
1236 break; 1239 break;
1237 } 1240 }
1238 } 1241 }
1239 1242
1240 } // namespace cc 1243 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698