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

Side by Side Diff: base/memory/discardable_memory_allocator.cc

Issue 1259333003: [tracing] Add SkResourceCache as suballocation to avoid double counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skia_v1
Patch Set: Removing segment dump from base. Created 5 years, 4 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 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 "base/memory/discardable_memory_allocator.h" 5 #include "base/memory/discardable_memory_allocator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/memory_allocator_dump.h"
9 #include "base/trace_event/process_memory_dump.h"
8 10
9 namespace base { 11 namespace base {
10 namespace { 12 namespace {
11 13
12 DiscardableMemoryAllocator* g_allocator = nullptr; 14 DiscardableMemoryAllocator* g_allocator = nullptr;
13 15
14 } // namespace 16 } // namespace
15 17
16 // static 18 // static
17 void DiscardableMemoryAllocator::SetInstance( 19 void DiscardableMemoryAllocator::SetInstance(
18 DiscardableMemoryAllocator* allocator) { 20 DiscardableMemoryAllocator* allocator) {
19 DCHECK(allocator); 21 DCHECK(allocator);
20 22
21 // Make sure this function is only called once before the first call 23 // Make sure this function is only called once before the first call
22 // to GetInstance(). 24 // to GetInstance().
23 DCHECK(!g_allocator); 25 DCHECK(!g_allocator);
24 26
25 g_allocator = allocator; 27 g_allocator = allocator;
26 } 28 }
27 29
28 // static 30 // static
29 DiscardableMemoryAllocator* DiscardableMemoryAllocator::GetInstance() { 31 DiscardableMemoryAllocator* DiscardableMemoryAllocator::GetInstance() {
30 DCHECK(g_allocator); 32 DCHECK(g_allocator);
31 return g_allocator; 33 return g_allocator;
32 } 34 }
33 35
36 // static
37 const char* DiscardableMemoryAllocator::GetMemoryPoolNameForTracing() {
38 return "discardable/allocated_objects";
39 }
40
34 } // namespace base 41 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_allocator.h ('k') | content/child/child_discardable_shared_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698