| Index: include/utils/SkProcessMemoryDump.h
|
| diff --git a/include/utils/SkProcessMemoryDump.h b/include/utils/SkProcessMemoryDump.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c25372c753a2f454933e25526718f10f835b3819
|
| --- /dev/null
|
| +++ b/include/utils/SkProcessMemoryDump.h
|
| @@ -0,0 +1,66 @@
|
| +/*
|
| + * Copyright (C) 2014 Google Inc. All rights reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +#ifndef SkProcessMemoryDump_DEFINED
|
| +#define SkProcessMemoryDump_DEFINED
|
| +
|
| +#include "SkMemoryAllocatorDump.h"
|
| +#include "SkString.h"
|
| +#include "SkTypes.h"
|
| +
|
| +// A container which holds all the dumps for the various allocators for a given
|
| +// process. Embedders of SkMemoryDumpProvider are expected to populate a
|
| +// SkProcessMemoryDump instance with the stats of their allocators.
|
| +class SK_API SkProcessMemoryDump {
|
| + public:
|
| + virtual ~SkProcessMemoryDump();
|
| +
|
| + // Creates a new MemoryAllocatorDump with the given name and returns the
|
| + // empty object back to the caller. |absoluteName| uniquely identifies the
|
| + // dump within the scope of a ProcessMemoryDump. It is possible to express
|
| + // nesting by means of a slash-separated path naming (e.g.,
|
| + // "allocator_name/arena_1/subheap_X").
|
| + // |guid| is an optional identifier, unique among all processes within the
|
| + // scope of a global dump. This is only relevant when using
|
| + // AddOwnershipEdge(). If omitted, it will be automatically generated.
|
| + virtual SkMemoryAllocatorDump* createMemoryAllocatorDump(
|
| + const SkString& absoluteName,
|
| + SkMemoryAllocatorDumpGuid guid) {
|
| + return nullptr;
|
| + }
|
| +
|
| + virtual SkMemoryAllocatorDump* createMemoryAllocatorDump(
|
| + const SkString& absoluteName) {
|
| + return nullptr;
|
| + }
|
| +
|
| + // Gets a previously created MemoryAllocatorDump given its name.
|
| + virtual SkMemoryAllocatorDump* getMemoryAllocatorDump(
|
| + const SkString& absoluteName) const {
|
| + return nullptr;
|
| + }
|
| +
|
| + // Adds an ownership relationship between two MemoryAllocatorDump(s) with
|
| + // the semantics: |source| owns |target|, and has the effect of attributing
|
| + // the memory usage of |target| to |source|. |importance| is optional and
|
| + // relevant only for the cases of co-ownership, where it acts as a z-index:
|
| + // the owner with the highest importance will be attributed |target|'s
|
| + // memory.
|
| + virtual void AddOwnershipEdge(SkMemoryAllocatorDumpGuid source,
|
| + SkMemoryAllocatorDumpGuid target,
|
| + int importance) {}
|
| +
|
| + virtual void AddOwnershipEdge(SkMemoryAllocatorDumpGuid source,
|
| + SkMemoryAllocatorDumpGuid target) {}
|
| +
|
| + // Returns guid corresponding to the given string (the hash value) for
|
| + // creating a WebMemoryAllocatorDump.
|
| + static SkMemoryAllocatorDumpGuid CreateWebMemoryAllocatorDumpGuid(
|
| + const SkString& guidStr);
|
| +};
|
| +
|
| +#endif // SkProcessMemoryDump_DEFINED
|
|
|