| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_discardable_memory_impl.h" | 5 #include "content/child/web_discardable_memory_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/discardable_memory.h" | 9 #include "base/memory/discardable_memory.h" |
| 10 #include "base/memory/discardable_memory_allocator.h" | 10 #include "base/memory/discardable_memory_allocator.h" |
| 11 #include "content/child/web_process_memory_dump_impl.h" | 11 #include "third_party/WebKit/public/platform/WebProcessMemoryDump.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" | 12 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 WebDiscardableMemoryImpl::~WebDiscardableMemoryImpl() {} | 16 WebDiscardableMemoryImpl::~WebDiscardableMemoryImpl() {} |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 scoped_ptr<WebDiscardableMemoryImpl> | 19 scoped_ptr<WebDiscardableMemoryImpl> |
| 20 WebDiscardableMemoryImpl::CreateLockedMemory(size_t size) { | 20 WebDiscardableMemoryImpl::CreateLockedMemory(size_t size) { |
| 21 return make_scoped_ptr(new WebDiscardableMemoryImpl( | 21 return make_scoped_ptr(new WebDiscardableMemoryImpl( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 void* WebDiscardableMemoryImpl::data() { | 34 void* WebDiscardableMemoryImpl::data() { |
| 35 return discardable_->data(); | 35 return discardable_->data(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 blink::WebMemoryAllocatorDump* | 38 blink::WebMemoryAllocatorDump* |
| 39 WebDiscardableMemoryImpl::createMemoryAllocatorDump( | 39 WebDiscardableMemoryImpl::createMemoryAllocatorDump( |
| 40 const blink::WebString& name, | 40 const blink::WebString& name, |
| 41 blink::WebProcessMemoryDump* wpmd) const { | 41 blink::WebProcessMemoryDump* wpmd) const { |
| 42 return static_cast<content::WebProcessMemoryDumpImpl*>(wpmd) | 42 return wpmd->createDiscardableMemoryAllocatorDump( |
| 43 ->CreateDiscardableMemoryAllocatorDump(name.utf8(), discardable_.get()); | 43 name.utf8(), discardable_.get()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 WebDiscardableMemoryImpl::WebDiscardableMemoryImpl( | 46 WebDiscardableMemoryImpl::WebDiscardableMemoryImpl( |
| 47 scoped_ptr<base::DiscardableMemory> memory) | 47 scoped_ptr<base::DiscardableMemory> memory) |
| 48 : discardable_(std::move(memory)) {} | 48 : discardable_(std::move(memory)) {} |
| 49 | 49 |
| 50 } // namespace content | 50 } // namespace content |
| OLD | NEW |