| 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 #include "platform/web_memory_allocator_dump_impl.h" | 5 #include "platform/web_memory_allocator_dump.h" |
| 6 | 6 |
| 7 #include "base/trace_event/memory_allocator_dump.h" | 7 #include "base/trace_event/memory_allocator_dump.h" |
| 8 #include "wtf/text/StringUTF8Adaptor.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 WebMemoryAllocatorDumpImpl::WebMemoryAllocatorDumpImpl( | 12 WebMemoryAllocatorDump::WebMemoryAllocatorDump( |
| 12 base::trace_event::MemoryAllocatorDump* memory_allocator_dump) | 13 base::trace_event::MemoryAllocatorDump* memory_allocator_dump) |
| 13 : memory_allocator_dump_(memory_allocator_dump), | 14 : memory_allocator_dump_(memory_allocator_dump), |
| 14 guid_(memory_allocator_dump->guid().ToUint64()) { | 15 guid_(memory_allocator_dump->guid().ToUint64()) { |
| 15 } | 16 } |
| 16 | 17 |
| 17 WebMemoryAllocatorDumpImpl::~WebMemoryAllocatorDumpImpl() { | 18 WebMemoryAllocatorDump::~WebMemoryAllocatorDump() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 void WebMemoryAllocatorDumpImpl::addScalar(const char* name, | 21 void WebMemoryAllocatorDump::addScalar(const char* name, |
| 21 const char* units, | 22 const char* units, |
| 22 uint64_t value) { | 23 uint64_t value) { |
| 23 memory_allocator_dump_->AddScalar(name, units, value); | 24 memory_allocator_dump_->AddScalar(name, units, value); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void WebMemoryAllocatorDumpImpl::addScalarF(const char* name, | 27 void WebMemoryAllocatorDump::addScalarF(const char* name, |
| 27 const char* units, | 28 const char* units, |
| 28 double value) { | 29 double value) { |
| 29 memory_allocator_dump_->AddScalarF(name, units, value); | 30 memory_allocator_dump_->AddScalarF(name, units, value); |
| 30 } | 31 } |
| 31 | 32 |
| 32 void WebMemoryAllocatorDumpImpl::addString(const char* name, | 33 void WebMemoryAllocatorDump::addString(const char* name, |
| 33 const char* units, | 34 const char* units, |
| 34 const blink::WebString& value) { | 35 const String& value) { |
| 35 memory_allocator_dump_->AddString(name, units, value.utf8()); | 36 StringUTF8Adaptor adapter(value); |
| 37 std::string utf8(adapter.data(), adapter.length()); |
| 38 memory_allocator_dump_->AddString(name, units, utf8); |
| 36 } | 39 } |
| 37 | 40 |
| 38 WebMemoryAllocatorDumpGuid WebMemoryAllocatorDumpImpl::guid() const { | 41 WebMemoryAllocatorDumpGuid WebMemoryAllocatorDump::guid() const { |
| 39 return guid_; | 42 return guid_; |
| 40 } | 43 } |
| 41 | 44 |
| 42 } // namespace blink | 45 } // namespace blink |
| OLD | NEW |