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

Side by Side Diff: public/platform/WebMemoryAllocatorDump.h

Issue 1159923006: [tracing] Expose AddOwnershipEdge and CreateAllocatorDump with guid to blink. (blink-side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing comments. Created 5 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 | public/platform/WebProcessMemoryDump.h » ('j') | 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 #ifndef WebMemoryAllocatorDump_h 5 #ifndef WebMemoryAllocatorDump_h
6 #define WebMemoryAllocatorDump_h 6 #define WebMemoryAllocatorDump_h
7 7
8 #include "WebCommon.h" 8 #include "WebCommon.h"
9 #include "WebString.h" 9 #include "WebString.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 // Class which holds the guid of the WebMemoryAllocatorDump.
14 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDumpGuid {
15 public:
16 explicit WebMemoryAllocatorDumpGuid(const uint64_t guid)
17 : m_guidInt(guid)
18 {
19 }
20
21 explicit WebMemoryAllocatorDumpGuid(const WebString& guid)
22 : m_guidInt(HashGuidString(guid))
23 {
24 }
25
26 private:
Primiano Tucci (use gerrit) 2015/06/09 20:51:34 I think this should be protected for sake of clari
27 virtual uint64_t HashGuidString(const WebString& guid) const
28 {
29 BLINK_ASSERT_NOT_REACHED();
30 return 0;
31 }
32
33 uint64_t m_guidInt;
34 };
35
13 // A container which holds all the attributes of a particular dump for a given 36 // A container which holds all the attributes of a particular dump for a given
14 // allocator. 37 // allocator.
15 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { 38 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump {
16 public: 39 public:
40 // TODO(ssid): This constructor should be removed once the usage is
41 // changed in chromium side (ETA: 15/06/2015).
42 WebMemoryAllocatorDump()
43 : m_guid(WebMemoryAllocatorDumpGuid(0))
44 {
45 }
46
47 WebMemoryAllocatorDump(WebMemoryAllocatorDumpGuid guid)
48 : m_guid(guid)
49 {
50 }
51
17 virtual ~WebMemoryAllocatorDump(); 52 virtual ~WebMemoryAllocatorDump();
18 53
19 // Adds a scalar attribute to the dump. 54 // Adds a scalar attribute to the dump.
20 // Arguments: 55 // Arguments:
21 // name: name of the attribute. Typical names, emitted by most allocators 56 // name: name of the attribute. Typical names, emitted by most allocators
22 // dump providers are: "outer_size", "inner_size", "objects_count". 57 // dump providers are: "outer_size", "inner_size", "objects_count".
23 // units: the units for the attribute. Gives a hint to the trace-viewer UI 58 // units: the units for the attribute. Gives a hint to the trace-viewer UI
24 // about the semantics of the attribute. 59 // about the semantics of the attribute.
25 // Currently supported values are "bytes" and "objects". 60 // Currently supported values are "bytes" and "objects".
26 // value: the value of the attribute. 61 // value: the value of the attribute.
27 virtual void AddScalar(const WebString& name, const char* units, uint64_t va lue) { BLINK_ASSERT_NOT_REACHED(); } 62 virtual void AddScalar(const WebString& name, const char* units, uint64_t va lue) { BLINK_ASSERT_NOT_REACHED(); }
28 virtual void AddScalarF(const WebString& name, const char* units, double val ue) { BLINK_ASSERT_NOT_REACHED(); } 63 virtual void AddScalarF(const WebString& name, const char* units, double val ue) { BLINK_ASSERT_NOT_REACHED(); }
29 virtual void AddString(const WebString& name, const char* units, const WebSt ring& value) { BLINK_ASSERT_NOT_REACHED(); } 64 virtual void AddString(const WebString& name, const char* units, const WebSt ring& value) { BLINK_ASSERT_NOT_REACHED(); }
65
66 // |guid| is an optional global dump identifier, unique across all processes
67 // within the scope of a global dump. It is only required when using the
68 // graph APIs (see AddOwnershipEdge) to express retention / suballocation or
69 // cross process sharing. See crbug.com/492102 for design docs.
70 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are
71 // expected to have the same guid.
72 const WebMemoryAllocatorDumpGuid& guid() const
73 {
74 return m_guid;
75 }
76
77 private:
78 WebMemoryAllocatorDumpGuid m_guid;
30 }; 79 };
31 80
32 } // namespace blink 81 } // namespace blink
33 82
34 #endif // WebMemoryAllocatorDump_h 83 #endif // WebMemoryAllocatorDump_h
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebProcessMemoryDump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698