OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 860 } |
861 | 861 |
862 return NULL; | 862 return NULL; |
863 } | 863 } |
864 | 864 |
865 int32 BackendImpl::GetCurrentEntryId() const { | 865 int32 BackendImpl::GetCurrentEntryId() const { |
866 return data_->header.this_id; | 866 return data_->header.this_id; |
867 } | 867 } |
868 | 868 |
869 int BackendImpl::MaxFileSize() const { | 869 int BackendImpl::MaxFileSize() const { |
870 return max_size_ / 8; | 870 return cache_type() == net::PNACL_CACHE ? max_size_ : max_size_ / 8; |
871 } | 871 } |
872 | 872 |
873 void BackendImpl::ModifyStorageSize(int32 old_size, int32 new_size) { | 873 void BackendImpl::ModifyStorageSize(int32 old_size, int32 new_size) { |
874 if (disabled_ || old_size == new_size) | 874 if (disabled_ || old_size == new_size) |
875 return; | 875 return; |
876 if (old_size > new_size) | 876 if (old_size > new_size) |
877 SubstractStorageSize(old_size - new_size); | 877 SubstractStorageSize(old_size - new_size); |
878 else | 878 else |
879 AddStorageSize(new_size - old_size); | 879 AddStorageSize(new_size - old_size); |
880 | 880 |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2109 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2110 total_memory = kMaxBuffersSize; | 2110 total_memory = kMaxBuffersSize; |
2111 | 2111 |
2112 done = true; | 2112 done = true; |
2113 } | 2113 } |
2114 | 2114 |
2115 return static_cast<int>(total_memory); | 2115 return static_cast<int>(total_memory); |
2116 } | 2116 } |
2117 | 2117 |
2118 } // namespace disk_cache | 2118 } // namespace disk_cache |
OLD | NEW |