summaryrefslogtreecommitdiffstats
path: root/chromium/net/disk_cache/cache_creator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/disk_cache/cache_creator.cc')
-rw-r--r--chromium/net/disk_cache/cache_creator.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/chromium/net/disk_cache/cache_creator.cc b/chromium/net/disk_cache/cache_creator.cc
index 1fee41f2738..866df10e372 100644
--- a/chromium/net/disk_cache/cache_creator.cc
+++ b/chromium/net/disk_cache/cache_creator.cc
@@ -7,10 +7,10 @@
#include "base/strings/stringprintf.h"
#include "net/base/cache_type.h"
#include "net/base/net_errors.h"
-#include "net/disk_cache/backend_impl.h"
+#include "net/disk_cache/blockfile/backend_impl.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/disk_cache.h"
-#include "net/disk_cache/mem_backend_impl.h"
+#include "net/disk_cache/memory/mem_backend_impl.h"
#include "net/disk_cache/simple/simple_backend_impl.h"
#ifdef USE_TRACING_CACHE_BACKEND
@@ -79,11 +79,14 @@ CacheCreator::~CacheCreator() {
}
int CacheCreator::Run() {
- // TODO(gavinp,pasko): Turn Simple Cache on for more cache types as
- // appropriate.
- if (backend_type_ == net::CACHE_BACKEND_SIMPLE &&
- (type_ == net::DISK_CACHE || type_ == net::APP_CACHE ||
- type_ == net::MEDIA_CACHE)) {
+#if defined(OS_ANDROID)
+ static const bool kSimpleBackendIsDefault = true;
+#else
+ static const bool kSimpleBackendIsDefault = false;
+#endif
+ if (backend_type_ == net::CACHE_BACKEND_SIMPLE ||
+ (backend_type_ == net::CACHE_BACKEND_DEFAULT &&
+ kSimpleBackendIsDefault)) {
disk_cache::SimpleBackendImpl* simple_cache =
new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_,
thread_.get(), net_log_);
@@ -91,6 +94,11 @@ int CacheCreator::Run() {
return simple_cache->Init(
base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
}
+
+ // Avoid references to blockfile functions on Android to reduce binary size.
+#if defined(OS_ANDROID)
+ return net::ERR_FAILED;
+#else
disk_cache::BackendImpl* new_cache =
new disk_cache::BackendImpl(path_, thread_.get(), net_log_);
created_cache_.reset(new_cache);
@@ -101,6 +109,7 @@ int CacheCreator::Run() {
base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
DCHECK_EQ(net::ERR_IO_PENDING, rv);
return rv;
+#endif
}
void CacheCreator::DoCallback(int result) {