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

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

Issue 804533005: Standardize usage of virtual/override/final specifiers in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify Created 6 years 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
« no previous file with comments | « base/memory/discardable_memory_shmem.h ('k') | base/memory/singleton_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/discardable_memory_shmem_allocator.h" 5 #include "base/memory/discardable_memory_shmem_allocator.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/discardable_shared_memory.h" 9 #include "base/memory/discardable_shared_memory.h"
10 10
11 namespace base { 11 namespace base {
12 namespace { 12 namespace {
13 13
14 // Default allocator implementation that allocates in-process 14 // Default allocator implementation that allocates in-process
15 // DiscardableSharedMemory instances. 15 // DiscardableSharedMemory instances.
16 class DiscardableMemoryShmemAllocatorImpl 16 class DiscardableMemoryShmemAllocatorImpl
17 : public DiscardableMemoryShmemAllocator { 17 : public DiscardableMemoryShmemAllocator {
18 public: 18 public:
19 // Overridden from DiscardableMemoryShmemAllocator: 19 // Overridden from DiscardableMemoryShmemAllocator:
20 virtual scoped_ptr<DiscardableSharedMemory> 20 scoped_ptr<DiscardableSharedMemory> AllocateLockedDiscardableSharedMemory(
21 AllocateLockedDiscardableSharedMemory(size_t size) override { 21 size_t size) override {
22 scoped_ptr<DiscardableSharedMemory> memory(new DiscardableSharedMemory); 22 scoped_ptr<DiscardableSharedMemory> memory(new DiscardableSharedMemory);
23 if (!memory->CreateAndMap(size)) 23 if (!memory->CreateAndMap(size))
24 return scoped_ptr<DiscardableSharedMemory>(); 24 return scoped_ptr<DiscardableSharedMemory>();
25 25
26 return memory.Pass(); 26 return memory.Pass();
27 } 27 }
28 }; 28 };
29 29
30 LazyInstance<DiscardableMemoryShmemAllocatorImpl>::Leaky g_default_allocator = 30 LazyInstance<DiscardableMemoryShmemAllocatorImpl>::Leaky g_default_allocator =
31 LAZY_INSTANCE_INITIALIZER; 31 LAZY_INSTANCE_INITIALIZER;
(...skipping 17 matching lines...) Expand all
49 // static 49 // static
50 DiscardableMemoryShmemAllocator* 50 DiscardableMemoryShmemAllocator*
51 DiscardableMemoryShmemAllocator::GetInstance() { 51 DiscardableMemoryShmemAllocator::GetInstance() {
52 if (!g_allocator) 52 if (!g_allocator)
53 g_allocator = g_default_allocator.Pointer(); 53 g_allocator = g_default_allocator.Pointer();
54 54
55 return g_allocator; 55 return g_allocator;
56 } 56 }
57 57
58 } // namespace base 58 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_shmem.h ('k') | base/memory/singleton_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698