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.
5 #include "content/child/web_discardable_memory_impl.h"
9 WebDiscardableMemoryImpl::~WebDiscardableMemoryImpl() {}
12 scoped_ptr
<WebDiscardableMemoryImpl
>
13 WebDiscardableMemoryImpl::CreateLockedMemory(size_t size
) {
14 scoped_ptr
<base::DiscardableMemory
> memory(
15 base::DiscardableMemory::CreateLockedMemory(size
));
17 return scoped_ptr
<WebDiscardableMemoryImpl
>();
18 return make_scoped_ptr(new WebDiscardableMemoryImpl(memory
.Pass()));
21 bool WebDiscardableMemoryImpl::lock() {
22 base::DiscardableMemoryLockStatus status
= discardable_
->Lock();
24 case base::DISCARDABLE_MEMORY_LOCK_STATUS_SUCCESS
:
26 case base::DISCARDABLE_MEMORY_LOCK_STATUS_PURGED
:
27 discardable_
->Unlock();
35 void WebDiscardableMemoryImpl::unlock() {
36 discardable_
->Unlock();
39 void* WebDiscardableMemoryImpl::data() {
40 return discardable_
->Memory();
43 WebDiscardableMemoryImpl::WebDiscardableMemoryImpl(
44 scoped_ptr
<base::DiscardableMemory
> memory
)
45 : discardable_(memory
.Pass()) {
48 } // namespace content