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

Side by Side Diff: skia/ext/skia_memory_dump_provider.cc

Issue 2015763003: [tracing] Support background mode in skia memory dump provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "skia_memory_dump_provider.h" 5 #include "skia_memory_dump_provider.h"
6 6
7 #include "base/trace_event/memory_allocator_dump.h" 7 #include "base/trace_event/memory_allocator_dump.h"
8 #include "base/trace_event/memory_dump_manager.h" 8 #include "base/trace_event/memory_dump_manager.h"
9 #include "base/trace_event/process_memory_dump.h" 9 #include "base/trace_event/process_memory_dump.h"
10 #include "skia/ext/skia_trace_memory_dump_impl.h" 10 #include "skia/ext/skia_trace_memory_dump_impl.h"
11 #include "third_party/skia/include/core/SkGraphics.h" 11 #include "third_party/skia/include/core/SkGraphics.h"
12 12
13 namespace skia { 13 namespace skia {
14 14
15 // static 15 // static
16 SkiaMemoryDumpProvider* SkiaMemoryDumpProvider::GetInstance() { 16 SkiaMemoryDumpProvider* SkiaMemoryDumpProvider::GetInstance() {
17 return base::Singleton< 17 return base::Singleton<
18 SkiaMemoryDumpProvider, 18 SkiaMemoryDumpProvider,
19 base::LeakySingletonTraits<SkiaMemoryDumpProvider>>::get(); 19 base::LeakySingletonTraits<SkiaMemoryDumpProvider>>::get();
20 } 20 }
21 21
22 SkiaMemoryDumpProvider::SkiaMemoryDumpProvider() {} 22 SkiaMemoryDumpProvider::SkiaMemoryDumpProvider() {}
23 23
24 SkiaMemoryDumpProvider::~SkiaMemoryDumpProvider() {} 24 SkiaMemoryDumpProvider::~SkiaMemoryDumpProvider() {}
25 25
26 bool SkiaMemoryDumpProvider::OnMemoryDump( 26 bool SkiaMemoryDumpProvider::OnMemoryDump(
27 const base::trace_event::MemoryDumpArgs& args, 27 const base::trace_event::MemoryDumpArgs& args,
28 base::trace_event::ProcessMemoryDump* process_memory_dump) { 28 base::trace_event::ProcessMemoryDump* process_memory_dump) {
29 if (args.level_of_detail ==
30 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
31 auto glyph_cache_dump =
32 process_memory_dump->CreateAllocatorDump("skia/sk_glyph_cache");
33 glyph_cache_dump->AddScalar(
34 base::trace_event::MemoryAllocatorDump::kNameSize,
35 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
36 SkGraphics::GetFontCacheUsed());
37 auto resource_cache_dump =
38 process_memory_dump->CreateAllocatorDump("skia/sk_resource_cache");
39 resource_cache_dump->AddScalar(
40 base::trace_event::MemoryAllocatorDump::kNameSize,
41 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
42 SkGraphics::GetResourceCacheTotalBytesUsed());
43 return true;
44 }
29 SkiaTraceMemoryDumpImpl skia_dumper(args.level_of_detail, 45 SkiaTraceMemoryDumpImpl skia_dumper(args.level_of_detail,
30 process_memory_dump); 46 process_memory_dump);
31 SkGraphics::DumpMemoryStatistics(&skia_dumper); 47 SkGraphics::DumpMemoryStatistics(&skia_dumper);
32 48
33 return true; 49 return true;
34 } 50 }
35 51
36 } // namespace skia 52 } // namespace skia
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698