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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: base/memory/discardable_memory_allocator.cc
diff --git a/base/memory/discardable_memory_allocator.cc b/base/memory/discardable_memory_allocator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0198371259ad90e8ec90c99825d382587265e767
--- /dev/null
+++ b/base/memory/discardable_memory_allocator.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/discardable_memory_allocator.h"
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/discardable_memory.h"
+#include "build/build_config.h"
+
+namespace base {
+
+#if !defined(OS_ANDROID)
+
+namespace {
+
+class DiscardableMemoryAllocatorImpl : public DiscardableMemoryAllocator {
+ public:
+ DiscardableMemoryAllocatorImpl() {}
+ virtual ~DiscardableMemoryAllocatorImpl() {}
+
+ // DiscardableMemoryAllocator:
+ virtual scoped_ptr<DiscardableMemory> Allocate(size_t size) OVERRIDE {
+ return DiscardableMemory::CreateLockedMemory(size);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocatorImpl);
+};
+
+} // namespace
+
+// static
+scoped_ptr<DiscardableMemoryAllocator> DiscardableMemoryAllocator::Create(
+ const std::string& name) {
+ return scoped_ptr<DiscardableMemoryAllocator>(
+ new DiscardableMemoryAllocatorImpl());
+}
+
+#endif
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698