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

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

Issue 276012: Convert SysInfo::AmountOfFreeDiskSpace from wstring to FilePath. (Closed)
Patch Set: compile Created 11 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
« 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/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/field_trial.h" 7 #include "base/field_trial.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // The maximum cache size will be either set explicitly by the caller, or 1022 // The maximum cache size will be either set explicitly by the caller, or
1023 // calculated by this code. 1023 // calculated by this code.
1024 void BackendImpl::AdjustMaxCacheSize(int table_len) { 1024 void BackendImpl::AdjustMaxCacheSize(int table_len) {
1025 if (max_size_) 1025 if (max_size_)
1026 return; 1026 return;
1027 1027
1028 // If table_len is provided, the index file exists. 1028 // If table_len is provided, the index file exists.
1029 DCHECK(!table_len || data_->header.magic); 1029 DCHECK(!table_len || data_->header.magic);
1030 1030
1031 // The user is not setting the size, let's figure it out. 1031 // The user is not setting the size, let's figure it out.
1032 int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_.ToWStringHack()); 1032 int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_);
1033 if (available < 0) { 1033 if (available < 0) {
1034 max_size_ = kDefaultCacheSize; 1034 max_size_ = kDefaultCacheSize;
1035 return; 1035 return;
1036 } 1036 }
1037 1037
1038 if (table_len) 1038 if (table_len)
1039 available += data_->header.num_bytes; 1039 available += data_->header.num_bytes;
1040 1040
1041 max_size_ = PreferedCacheSize(available); 1041 max_size_ = PreferedCacheSize(available);
1042 1042
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 1620
1621 return num_dirty; 1621 return num_dirty;
1622 } 1622 }
1623 1623
1624 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { 1624 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) {
1625 RankingsNode* rankings = cache_entry->rankings()->Data(); 1625 RankingsNode* rankings = cache_entry->rankings()->Data();
1626 return !rankings->dummy; 1626 return !rankings->dummy;
1627 } 1627 }
1628 1628
1629 } // namespace disk_cache 1629 } // namespace disk_cache
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