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

Side by Side Diff: net/disk_cache/mem_backend_impl.cc

Issue 4003: Fix AmountOfFreeDiskSpace to be able to differentiate an error... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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
« no previous file with comments | « base/sys_info_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "net/disk_cache/mem_backend_impl.h" 5 #include "net/disk_cache/mem_backend_impl.h"
6 6
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 #include "net/disk_cache/cache_util.h" 8 #include "net/disk_cache/cache_util.h"
9 #include "net/disk_cache/mem_entry_impl.h" 9 #include "net/disk_cache/mem_entry_impl.h"
10 10
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 // ------------------------------------------------------------------------ 38 // ------------------------------------------------------------------------
39 39
40 bool MemBackendImpl::Init() { 40 bool MemBackendImpl::Init() {
41 if (max_size_) 41 if (max_size_)
42 return true; 42 return true;
43 43
44 int64 total_memory = base::SysInfo::AmountOfPhysicalMemory(); 44 int64 total_memory = base::SysInfo::AmountOfPhysicalMemory();
45 45
46 if (total_memory < 0) { 46 if (total_memory <= 0) {
47 max_size_ = kDefaultCacheSize; 47 max_size_ = kDefaultCacheSize;
48 return true; 48 return true;
49 } 49 }
50 50
51 // We want to use up to 2% of the computer's memory, with a limit of 50 MB, 51 // We want to use up to 2% of the computer's memory, with a limit of 50 MB,
52 // reached on systemd with more than 2.5 GB of RAM. 52 // reached on systemd with more than 2.5 GB of RAM.
53 total_memory = total_memory * 2 / 100; 53 total_memory = total_memory * 2 / 100;
54 if (total_memory > kDefaultCacheSize * 5) 54 if (total_memory > kDefaultCacheSize * 5)
55 max_size_ = kDefaultCacheSize * 5; 55 max_size_ = kDefaultCacheSize * 5;
56 else 56 else
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void MemBackendImpl::UpdateRank(MemEntryImpl* node) { 244 void MemBackendImpl::UpdateRank(MemEntryImpl* node) {
245 rankings_.UpdateRank(node); 245 rankings_.UpdateRank(node);
246 } 246 }
247 247
248 int MemBackendImpl::MaxFileSize() const { 248 int MemBackendImpl::MaxFileSize() const {
249 return max_size_ / 8; 249 return max_size_ / 8;
250 } 250 }
251 251
252 } // namespace disk_cache 252 } // namespace disk_cache
253 253
OLDNEW
« no previous file with comments | « base/sys_info_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698