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

Side by Side Diff: base/test/test_discardable_memory_shmem_allocator.cc

Issue 1004043002: Re-land: base: Implement browser process support for discardable memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review feedback Created 5 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 2015 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 "base/test/test_discardable_memory_shmem_allocator.h"
6
7 #include <stdint.h>
8
9 namespace base {
10 namespace {
11
12 class DiscardableMemoryShmemChunkImpl : public DiscardableMemoryShmemChunk {
13 public:
14 explicit DiscardableMemoryShmemChunkImpl(size_t size)
15 : memory_(new uint8_t[size]) {}
16
17 // Overridden from DiscardableMemoryShmemChunk:
18 bool Lock() override { return false; }
danakj 2015/03/13 21:59:07 lock returning false i found surprising, then thin
reveman 2015/03/13 22:07:33 The memory is locked initially. It will always fai
danakj 2015/03/13 22:32:45 OK.
19 void Unlock() override {}
20 void* Memory() const override { return memory_.get(); }
21
22 private:
23 scoped_ptr<uint8_t[]> memory_;
24 };
25
26 } // namespace
27
28 TestDiscardableMemoryShmemAllocator::TestDiscardableMemoryShmemAllocator() {
29 }
30
31 TestDiscardableMemoryShmemAllocator::~TestDiscardableMemoryShmemAllocator() {
32 }
33
34 scoped_ptr<DiscardableMemoryShmemChunk>
35 TestDiscardableMemoryShmemAllocator::AllocateLockedDiscardableMemory(
36 size_t size) {
37 return make_scoped_ptr(new DiscardableMemoryShmemChunkImpl(size));
38 }
39
40 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698