Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(hajimehoshi): WTF_MAKE_NONCOPYABLE works only in Blink side so far. | |
| 12 // This macro should be replaced with DISALLOW_COPY_AND_ASSIGN in the near | |
| 13 // future. | |
| 14 #if INSIDE_BLINK | |
| 15 #include "wtf/Noncopyable.h" | |
| 16 #endif | |
| 17 | |
| 18 #include <stdint.h> | |
| 19 | |
| 20 namespace base { | |
| 21 namespace trace_event { | |
| 22 class MemoryAllocatorDump; | |
| 23 } // namespace base | |
| 24 } // namespace trace_event | |
| 25 | |
| 11 namespace blink { | 26 namespace blink { |
| 12 typedef uint64_t WebMemoryAllocatorDumpGuid; | 27 typedef uint64_t WebMemoryAllocatorDumpGuid; |
| 13 | 28 |
| 14 // A container which holds all the attributes of a particular dump for a given | 29 // A container which holds all the attributes of a particular dump for a given |
| 15 // allocator. | 30 // allocator. |
| 16 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { | 31 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { |
| 32 #if INSIDE_BLINK | |
| 33 WTF_MAKE_NONCOPYABLE(WebMemoryAllocatorDump); | |
|
esprehn
2016/02/29 06:51:20
Don't do this. Use WebNoncopyable which does what
haraken
2016/02/29 06:55:30
So as tkent@ and I are saying in the above, I'd su
hajimehoshi
2016/02/29 08:21:48
Done.
| |
| 34 #endif | |
| 17 public: | 35 public: |
| 18 virtual ~WebMemoryAllocatorDump(); | 36 explicit WebMemoryAllocatorDump(base::trace_event::MemoryAllocatorDump*); |
| 37 ~WebMemoryAllocatorDump(); | |
| 19 | 38 |
| 20 // Adds a scalar attribute to the dump. | 39 // Adds a scalar attribute to the dump. |
| 21 // Arguments: | 40 // Arguments: |
| 22 // name: name of the attribute. Typical names, emitted by most allocators | 41 // name: name of the attribute. Typical names, emitted by most allocators |
| 23 // dump providers are: "size" and "objects_count". | 42 // dump providers are: "size" and "objects_count". |
| 24 // units: the units for the attribute. Gives a hint to the trace-viewer UI | 43 // units: the units for the attribute. Gives a hint to the trace-viewer UI |
| 25 // about the semantics of the attribute. | 44 // about the semantics of the attribute. |
| 26 // Currently supported values are "bytes" and "objects". | 45 // Currently supported values are "bytes" and "objects". |
| 27 // value: the value of the attribute. | 46 // value: the value of the attribute. |
| 28 virtual void addScalar(const char* name, const char* units, uint64_t value) {} | 47 void addScalar(const char* name, const char* units, uint64_t value); |
| 29 virtual void addScalarF(const char* name, const char* units, double value) { } | 48 void addScalarF(const char* name, const char* units, double value); |
| 30 virtual void addString(const char* name, const char* units, const WebString& value) {} | 49 void addString(const char* name, const char* units, const WebString& value); |
| 31 | 50 |
| 32 // |guid| is an optional global dump identifier, unique across all processes | 51 // |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 | 52 // within the scope of a global dump. It is only required when using the |
| 34 // graph APIs (see AddOwnershipEdge) to express retention / suballocation or | 53 // graph APIs (see AddOwnershipEdge) to express retention / suballocation or |
| 35 // cross process sharing. See crbug.com/492102 for design docs. | 54 // cross process sharing. See crbug.com/492102 for design docs. |
| 36 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are | 55 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are |
| 37 // expected to have the same guid. | 56 // expected to have the same guid. |
| 38 virtual WebMemoryAllocatorDumpGuid guid() const | 57 WebMemoryAllocatorDumpGuid guid() const; |
| 39 { | 58 |
| 40 BLINK_ASSERT_NOT_REACHED(); | 59 private: |
| 41 return 0; | 60 base::trace_event::MemoryAllocatorDump* m_memoryAllocatorDump; // Not owned. |
| 42 } | 61 blink::WebMemoryAllocatorDumpGuid m_guid; |
| 43 }; | 62 }; |
| 44 | 63 |
| 45 } // namespace blink | 64 } // namespace blink |
| 46 | 65 |
| 47 #endif // WebMemoryAllocatorDump_h | 66 #endif // WebMemoryAllocatorDump_h |
| OLD | NEW |