Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / WebMemoryAllocatorDump.h
blobd57eab7e15dd7de6925f45943246a2d11cc7b000
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
3 // found in the LICENSE file.
5 #ifndef WebMemoryAllocatorDump_h
6 #define WebMemoryAllocatorDump_h
8 #include "WebCommon.h"
9 #include "WebString.h"
11 namespace blink {
12 typedef uint64_t WebMemoryAllocatorDumpGuid;
14 // A container which holds all the attributes of a particular dump for a given
15 // allocator.
16 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump {
17 public:
18 virtual ~WebMemoryAllocatorDump();
20 // Adds a scalar attribute to the dump.
21 // Arguments:
22 // name: name of the attribute. Typical names, emitted by most allocators
23 // dump providers are: "size" and "objects_count".
24 // units: the units for the attribute. Gives a hint to the trace-viewer UI
25 // about the semantics of the attribute.
26 // Currently supported values are "bytes" and "objects".
27 // value: the value of the attribute.
28 virtual void AddScalar(const char* name, const char* units, uint64_t value) { }
29 virtual void AddScalarF(const char* name, const char* units, double value) { }
30 virtual void AddString(const char* name, const char* units, const WebString& value) { }
32 // |guid| is an optional global dump identifier, unique across all processes
33 // within the scope of a global dump. It is only required when using the
34 // graph APIs (see AddOwnershipEdge) to express retention / suballocation or
35 // cross process sharing. See crbug.com/492102 for design docs.
36 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are
37 // expected to have the same guid.
38 virtual WebMemoryAllocatorDumpGuid guid() const
40 BLINK_ASSERT_NOT_REACHED();
41 return 0;
45 } // namespace blink
47 #endif // WebMemoryAllocatorDump_h