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

Side by Side Diff: base/memory/discardable_memory_allocator.cc

Issue 25293002: Add DiscardableMemoryAllocator to work around FD limit issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewers' comments Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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/memory/discardable_memory_allocator.h"
6
7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h"
9 #include "base/memory/discardable_memory.h"
10 #include "build/build_config.h"
11
12 namespace base {
13
14 #if !defined(OS_ANDROID)
15
16 namespace {
17
18 class DiscardableMemoryAllocatorImpl : public DiscardableMemoryAllocator {
19 public:
20 DiscardableMemoryAllocatorImpl() {}
21 virtual ~DiscardableMemoryAllocatorImpl() {}
22
23 // DiscardableMemoryAllocator:
24 virtual scoped_ptr<DiscardableMemory> Allocate(size_t size) OVERRIDE {
25 return DiscardableMemory::CreateLockedMemory(size);
26 }
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocatorImpl);
30 };
31
32 } // namespace
33
34 // static
35 scoped_ptr<DiscardableMemoryAllocator> DiscardableMemoryAllocator::Create(
36 const std::string& name) {
37 return scoped_ptr<DiscardableMemoryAllocator>(
38 new DiscardableMemoryAllocatorImpl());
39 }
40
41 #endif
42
43 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698