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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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_allocator.h"
6
7 #include <stdint.h>
8
9 #include "base/memory/discardable_memory.h"
10
11 namespace base {
12 namespace {
13
14 class DiscardableMemoryImpl : public DiscardableMemory {
15 public:
16 explicit DiscardableMemoryImpl(size_t size) : memory_(new uint8_t[size]) {}
17
18 // Overridden from DiscardableMemory:
19 bool Lock() override { return false; }
20 void Unlock() override {}
21 void* Memory() const override { return memory_.get(); }
22
23 private:
24 scoped_ptr<uint8_t[]> memory_;
25 };
26
27 } // namespace
28
29 TestDiscardableMemoryAllocator::TestDiscardableMemoryAllocator() {
30 }
31
32 TestDiscardableMemoryAllocator::~TestDiscardableMemoryAllocator() {
33 }
34
35 scoped_ptr<DiscardableMemory>
36 TestDiscardableMemoryAllocator::AllocateLockedDiscardableMemory(size_t size) {
37 return make_scoped_ptr(new DiscardableMemoryImpl(size));
38 }
39
40 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_discardable_memory_allocator.h ('k') | base/test/test_discardable_memory_shmem_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698