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

Side by Side Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 807303002: base: Add free list implementation to browser-wide discardable memory system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable-shared-memory-ashmem
Patch Set: rebase 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 | « content/common/host_discardable_shared_memory_manager.h ('k') | content/content_common.gypi » ('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 "content/common/host_discardable_shared_memory_manager.h" 5 #include "content/common/host_discardable_shared_memory_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/debug/crash_logging.h" 10 #include "base/debug/crash_logging.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 HostDiscardableSharedMemoryManager::~HostDiscardableSharedMemoryManager() { 47 HostDiscardableSharedMemoryManager::~HostDiscardableSharedMemoryManager() {
48 } 48 }
49 49
50 HostDiscardableSharedMemoryManager* 50 HostDiscardableSharedMemoryManager*
51 HostDiscardableSharedMemoryManager::current() { 51 HostDiscardableSharedMemoryManager::current() {
52 return g_discardable_shared_memory_manager.Pointer(); 52 return g_discardable_shared_memory_manager.Pointer();
53 } 53 }
54 54
55 scoped_ptr<base::DiscardableSharedMemory> 55 scoped_ptr<base::DiscardableMemoryShmemChunk>
56 HostDiscardableSharedMemoryManager::AllocateLockedDiscardableSharedMemory( 56 HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
57 size_t size) { 57 size_t size) {
58 // TODO(reveman): Need to implement this for discardable memory support in 58 // TODO(reveman): Need to implement this for discardable memory support in
59 // the browser process. 59 // the browser process.
60 NOTIMPLEMENTED(); 60 NOTIMPLEMENTED();
61 return scoped_ptr<base::DiscardableSharedMemory>(); 61 return nullptr;
62 } 62 }
63 63
64 void HostDiscardableSharedMemoryManager:: 64 void HostDiscardableSharedMemoryManager::
65 AllocateLockedDiscardableSharedMemoryForChild( 65 AllocateLockedDiscardableSharedMemoryForChild(
66 base::ProcessHandle process_handle, 66 base::ProcessHandle process_handle,
67 size_t size, 67 size_t size,
68 base::SharedMemoryHandle* shared_memory_handle) { 68 base::SharedMemoryHandle* shared_memory_handle) {
69 base::AutoLock lock(lock_); 69 base::AutoLock lock(lock_);
70 70
71 // Memory usage must be reduced to prevent the addition of |size| from 71 // Memory usage must be reduced to prevent the addition of |size| from
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 enforce_memory_policy_pending_ = true; 248 enforce_memory_policy_pending_ = true;
249 base::MessageLoop::current()->PostDelayedTask( 249 base::MessageLoop::current()->PostDelayedTask(
250 FROM_HERE, 250 FROM_HERE,
251 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 251 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
252 weak_ptr_factory_.GetWeakPtr()), 252 weak_ptr_factory_.GetWeakPtr()),
253 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 253 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
254 } 254 }
255 255
256 } // namespace content 256 } // namespace content
OLDNEW
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698