summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-07-29 18:22:28 +0100
committerKristian Monsen <kristianm@google.com>2010-08-11 11:34:17 +0100
commit00d26a728db2814620f390b418a7d6325ce5aca6 (patch)
tree1a08a766ac3682d979bba42bb32150b3e6b93fdc /net/disk_cache
parentb3a45980d5cfbb62c937045255faa29a8ffea9f3 (diff)
downloadexternal_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.zip
external_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.tar.gz
external_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.tar.bz2
Collection of all the changs to external chromium.
Time is running out, I guess we have to submit this and remember to upstream. Rebased to chromium r53293 Change-Id: Ie61ca0433b1eedd90144aee87c5efcd68fdc37ac
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc4
-rw-r--r--net/disk_cache/file_posix.cc5
-rw-r--r--net/disk_cache/mem_backend_impl.cc5
3 files changed, 13 insertions, 1 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 13b17f4..84f023d 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1257,7 +1257,11 @@ void BackendImpl::AdjustMaxCacheSize(int table_len) {
DCHECK(!table_len || data_->header.magic);
// The user is not setting the size, let's figure it out.
+#ifdef ANDROID
+ int64 available = 10 * 1024 * 1024; // 10 MB
+#else
int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_);
+#endif
if (available < 0) {
max_size_ = kDefaultCacheSize;
return;
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 295f744..38834a6 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -307,7 +307,12 @@ bool File::Write(const void* buffer, size_t buffer_len, size_t offset) {
if (buffer_len > ULONG_MAX || offset > ULONG_MAX)
return false;
+#ifdef ANDROID
+ int ret = pwrite(platform_file_, const_cast<void*>(buffer), buffer_len, offset);
+#else
int ret = pwrite(platform_file_, buffer, buffer_len, offset);
+#endif
+
return (static_cast<size_t>(ret) == buffer_len);
}
diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc
index fe57d7d..b5064b2 100644
--- a/net/disk_cache/mem_backend_impl.cc
+++ b/net/disk_cache/mem_backend_impl.cc
@@ -41,6 +41,7 @@ Backend* MemBackendImpl::CreateBackend(int max_bytes) {
}
bool MemBackendImpl::Init() {
+#ifndef ANDROID
if (max_size_)
return true;
@@ -58,7 +59,9 @@ bool MemBackendImpl::Init() {
max_size_ = kDefaultCacheSize * 5;
else
max_size_ = static_cast<int32>(total_memory);
-
+#else
+ max_size_ = kDefaultCacheSize*3;
+#endif
return true;
}