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

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: Adding asserts. 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
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 // Struct which has the guid of the WebMemoryAllocatorDump. The guid can either
14 // be uint64_t or WebString.
15 struct BLINK_PLATFORM_EXPORT WebMemoryAllocatorDumpGuid {
16 public:
17 enum GuidType {
18 IntType,
19 StringType
20 };
21
22 explicit WebMemoryAllocatorDumpGuid(const uint64_t guid)
23 : guidInt(guid)
24 , guidString()
25 , type(IntType)
26 {
27 }
28
29 explicit WebMemoryAllocatorDumpGuid(const WebString& guid)
30 : guidInt(0)
31 , guidString(guid)
32 , type(StringType)
33 {
34 }
35
36 uint64_t guidInt;
37 WebString guidString;
38 GuidType type;
39 };
40
13 // A container which holds all the attributes of a particular dump for a given 41 // A container which holds all the attributes of a particular dump for a given
14 // allocator. 42 // allocator.
15 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { 43 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump {
16 public: 44 public:
45 // TODO(ssid): This constructor should be removed once the usage is
Primiano Tucci (use gerrit) 2015/06/08 09:39:16 I don't think you need neither of these constructo
46 // changed in chromium side (crbug.com/480500).
47 WebMemoryAllocatorDump()
48 : m_guid(WebMemoryAllocatorDumpGuid(0))
49 {
50 }
51
52 WebMemoryAllocatorDump(WebMemoryAllocatorDumpGuid guid)
53 : m_guid(guid)
54 {
55 }
56
17 virtual ~WebMemoryAllocatorDump(); 57 virtual ~WebMemoryAllocatorDump();
18 58
19 // Adds a scalar attribute to the dump. 59 // Adds a scalar attribute to the dump.
20 // Arguments: 60 // Arguments:
21 // name: name of the attribute. Typical names, emitted by most allocators 61 // name: name of the attribute. Typical names, emitted by most allocators
22 // dump providers are: "outer_size", "inner_size", "objects_count". 62 // dump providers are: "outer_size", "inner_size", "objects_count".
23 // units: the units for the attribute. Gives a hint to the trace-viewer UI 63 // units: the units for the attribute. Gives a hint to the trace-viewer UI
24 // about the semantics of the attribute. 64 // about the semantics of the attribute.
25 // Currently supported values are "bytes" and "objects". 65 // Currently supported values are "bytes" and "objects".
26 // value: the value of the attribute. 66 // value: the value of the attribute.
27 virtual void AddScalar(const WebString& name, const char* units, uint64_t va lue) { BLINK_ASSERT_NOT_REACHED(); } 67 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(); } 68 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(); } 69 virtual void AddString(const WebString& name, const char* units, const WebSt ring& value) { BLINK_ASSERT_NOT_REACHED(); }
70
71 // |guid| is an optional global dump identifier, unique across all processes
72 // within the scope of a global dump. It is only required when using the
73 // graph APIs (see TODO_method_name) to express retention / suballocation or
Primiano Tucci (use gerrit) 2015/06/08 09:39:16 s/TODO_method_name/AddOwnershipEdge/
ssid 2015/06/08 14:29:19 Done.
74 // cross process sharing. See crbug.com/492102 for design docs.
75 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are
76 // expected to have the same guid. Always returns WebMemoryAllocatorDumpGuid
77 // with IntType.
78 const WebMemoryAllocatorDumpGuid& guid() const
79 {
80 BLINK_ASSERT(m_guid.guidInt);
Primiano Tucci (use gerrit) 2015/06/08 09:39:16 This should be just a virtual and the chrome layer
81 return m_guid;
82 }
83
84 protected:
85 WebMemoryAllocatorDumpGuid m_guid;
Primiano Tucci (use gerrit) 2015/06/08 09:39:16 You don't need this. Just pass the guid you get in
30 }; 86 };
31 87
32 } // namespace blink 88 } // namespace blink
33 89
34 #endif // WebMemoryAllocatorDump_h 90 #endif // WebMemoryAllocatorDump_h
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebProcessMemoryDump.h » ('j') | public/platform/WebProcessMemoryDump.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698