[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / child / web_discardable_memory_impl.cc
blobe2ea7a2a0d4bb924b66da359c2c8ab229395b681
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"
7 #include "base/memory/discardable_memory.h"
8 #include "base/memory/discardable_memory_allocator.h"
10 namespace content {
12 WebDiscardableMemoryImpl::~WebDiscardableMemoryImpl() {}
14 // static
15 scoped_ptr<WebDiscardableMemoryImpl>
16 WebDiscardableMemoryImpl::CreateLockedMemory(size_t size) {
17 return make_scoped_ptr(new WebDiscardableMemoryImpl(
18 base::DiscardableMemoryAllocator::GetInstance()
19 ->AllocateLockedDiscardableMemory(size)));
22 bool WebDiscardableMemoryImpl::lock() {
23 return discardable_->Lock();
26 void WebDiscardableMemoryImpl::unlock() {
27 discardable_->Unlock();
30 void* WebDiscardableMemoryImpl::data() {
31 return discardable_->data();
34 WebDiscardableMemoryImpl::WebDiscardableMemoryImpl(
35 scoped_ptr<base::DiscardableMemory> memory)
36 : discardable_(memory.Pass()) {
39 } // namespace content