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

Side by Side Diff: include/utils/SkProcessMemoryDump.h

Issue 1263813002: [WIP] Exposing memory-infra to Skia. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: One more. 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
« no previous file with comments | « include/utils/SkMemoryAllocatorDump.h ('k') | 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
(Empty)
1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkProcessMemoryDump_DEFINED
9 #define SkProcessMemoryDump_DEFINED
10
11 #include "SkMemoryAllocatorDump.h"
12 #include "SkString.h"
13 #include "SkTypes.h"
14
15 // A container which holds all the dumps for the various allocators for a given
16 // process. Embedders of SkMemoryDumpProvider are expected to populate a
17 // SkProcessMemoryDump instance with the stats of their allocators.
18 class SK_API SkProcessMemoryDump {
19 public:
20 virtual ~SkProcessMemoryDump();
21
22 // Creates a new MemoryAllocatorDump with the given name and returns the
23 // empty object back to the caller. |absoluteName| uniquely identifies the
24 // dump within the scope of a ProcessMemoryDump. It is possible to express
25 // nesting by means of a slash-separated path naming (e.g.,
26 // "allocator_name/arena_1/subheap_X").
27 // |guid| is an optional identifier, unique among all processes within the
28 // scope of a global dump. This is only relevant when using
29 // AddOwnershipEdge(). If omitted, it will be automatically generated.
30 virtual SkMemoryAllocatorDump* createMemoryAllocatorDump(
31 const SkString& absoluteName,
32 SkMemoryAllocatorDumpGuid guid) {
33 return nullptr;
34 }
35
36 virtual SkMemoryAllocatorDump* createMemoryAllocatorDump(
37 const SkString& absoluteName) {
38 return nullptr;
39 }
40
41 // Gets a previously created MemoryAllocatorDump given its name.
42 virtual SkMemoryAllocatorDump* getMemoryAllocatorDump(
43 const SkString& absoluteName) const {
44 return nullptr;
45 }
46
47 // Adds an ownership relationship between two MemoryAllocatorDump(s) with
48 // the semantics: |source| owns |target|, and has the effect of attributing
49 // the memory usage of |target| to |source|. |importance| is optional and
50 // relevant only for the cases of co-ownership, where it acts as a z-index:
51 // the owner with the highest importance will be attributed |target|'s
52 // memory.
53 virtual void AddOwnershipEdge(SkMemoryAllocatorDumpGuid source,
54 SkMemoryAllocatorDumpGuid target,
55 int importance) {}
56
57 virtual void AddOwnershipEdge(SkMemoryAllocatorDumpGuid source,
58 SkMemoryAllocatorDumpGuid target) {}
59
60 // Returns guid corresponding to the given string (the hash value) for
61 // creating a WebMemoryAllocatorDump.
62 static SkMemoryAllocatorDumpGuid CreateWebMemoryAllocatorDumpGuid(
63 const SkString& guidStr);
64 };
65
66 #endif // SkProcessMemoryDump_DEFINED
OLDNEW
« no previous file with comments | « include/utils/SkMemoryAllocatorDump.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698