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

Side by Side Diff: content/child/web_discardable_memory_impl.cc

Issue 1787973002: Replace blink::WebDiscardableMemory with base::DiscardableMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing OwnPtr/PassOwnPtr includes in SharedBufferTest Created 4 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/child/web_discardable_memory_impl.h"
6
7 #include <utility>
8
9 #include "base/memory/discardable_memory.h"
10 #include "base/memory/discardable_memory_allocator.h"
11 #include "third_party/WebKit/public/platform/WebProcessMemoryDump.h"
12 #include "third_party/WebKit/public/platform/WebString.h"
13
14 namespace content {
15
16 WebDiscardableMemoryImpl::~WebDiscardableMemoryImpl() {}
17
18 // static
19 scoped_ptr<WebDiscardableMemoryImpl>
20 WebDiscardableMemoryImpl::CreateLockedMemory(size_t size) {
21 return make_scoped_ptr(new WebDiscardableMemoryImpl(
22 base::DiscardableMemoryAllocator::GetInstance()
23 ->AllocateLockedDiscardableMemory(size)));
24 }
25
26 bool WebDiscardableMemoryImpl::lock() {
27 return discardable_->Lock();
28 }
29
30 void WebDiscardableMemoryImpl::unlock() {
31 discardable_->Unlock();
32 }
33
34 void* WebDiscardableMemoryImpl::data() {
35 return discardable_->data();
36 }
37
38 blink::WebMemoryAllocatorDump*
39 WebDiscardableMemoryImpl::createMemoryAllocatorDump(
40 const blink::WebString& name,
41 blink::WebProcessMemoryDump* wpmd) const {
42 return wpmd->createDiscardableMemoryAllocatorDump(
43 name.utf8(), discardable_.get());
44 }
45
46 WebDiscardableMemoryImpl::WebDiscardableMemoryImpl(
47 scoped_ptr<base::DiscardableMemory> memory)
48 : discardable_(std::move(memory)) {}
49
50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698