summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/about_flags.cc2
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc10
-rw-r--r--content/browser/gpu/shader_disk_cache.cc4
-rw-r--r--net/disk_cache/backend_unittest.cc12
-rw-r--r--net/disk_cache/cache_creator.cc19
-rw-r--r--net/disk_cache/simple/simple_histogram_macros.h5
6 files changed, 37 insertions, 15 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index ce5ef11..095ca8f 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1357,7 +1357,7 @@ const Experiment kExperiments[] = {
"enable-simple-cache-backend",
IDS_FLAGS_ENABLE_SIMPLE_CACHE_BACKEND_NAME,
IDS_FLAGS_ENABLE_SIMPLE_CACHE_BACKEND_DESCRIPTION,
- kOsAll,
+ kOsWin | kOsMac | kOsLinux | kOsCrOS,
MULTI_VALUE_TYPE(kSimpleCacheBackendChoices)
},
{
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index ceeeb42..a48a6b1 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -55,6 +55,9 @@
namespace {
net::BackendType ChooseCacheBackendType() {
+#if defined(OS_ANDROID)
+ return net::CACHE_BACKEND_SIMPLE;
+#else
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) {
const std::string opt_value =
@@ -66,13 +69,6 @@ net::BackendType ChooseCacheBackendType() {
}
const std::string experiment_name =
base::FieldTrialList::FindFullName("SimpleCacheTrial");
-#if defined(OS_ANDROID)
- if (experiment_name == "ExperimentNo" ||
- experiment_name == "ExperimentControl") {
- return net::CACHE_BACKEND_BLOCKFILE;
- }
- return net::CACHE_BACKEND_SIMPLE;
-#else
if (experiment_name == "ExperimentYes" ||
experiment_name == "ExperimentYes2") {
return net::CACHE_BACKEND_SIMPLE;
diff --git a/content/browser/gpu/shader_disk_cache.cc b/content/browser/gpu/shader_disk_cache.cc
index fc578bc..c987cef 100644
--- a/content/browser/gpu/shader_disk_cache.cc
+++ b/content/browser/gpu/shader_disk_cache.cc
@@ -524,7 +524,7 @@ void ShaderDiskCache::Init() {
int rv = disk_cache::CreateCacheBackend(
net::SHADER_CACHE,
- net::CACHE_BACKEND_BLOCKFILE,
+ net::CACHE_BACKEND_DEFAULT,
cache_path_.Append(kGpuCachePath),
gpu::kDefaultMaxProgramCacheMemoryBytes,
true,
@@ -541,7 +541,7 @@ void ShaderDiskCache::Cache(const std::string& key, const std::string& shader) {
if (!cache_available_)
return;
- ShaderDiskCacheEntry* shim =
+ scoped_refptr<ShaderDiskCacheEntry> shim =
new ShaderDiskCacheEntry(AsWeakPtr(), key, shader);
shim->Cache();
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 68da572..e118dc6 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -668,6 +668,9 @@ TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate_Fast) {
}
#endif
+// Disabled on android since this test requires cache creator to create
+// blockfile caches.
+#if !defined(OS_ANDROID)
TEST_F(DiskCacheTest, TruncatedIndex) {
ASSERT_TRUE(CleanupCacheDir());
base::FilePath index = cache_path_.AppendASCII("index");
@@ -693,6 +696,7 @@ TEST_F(DiskCacheTest, TruncatedIndex) {
ASSERT_FALSE(backend);
}
+#endif
void DiskCacheBackendTest::BackendSetSize() {
const int cache_size = 0x10000; // 64 kB
@@ -1837,6 +1841,9 @@ class BadEntropyProvider : public base::FieldTrial::EntropyProvider {
// Tests that the disk cache successfully joins the control group, dropping the
// existing cache in favour of a new empty cache.
+// Disabled on android since this test requires cache creator to create
+// blockfile caches.
+#if !defined(OS_ANDROID)
TEST_F(DiskCacheTest, SimpleCacheControlJoin) {
base::Thread cache_thread("CacheThread");
ASSERT_TRUE(cache_thread.StartWithOptions(
@@ -1867,6 +1874,7 @@ TEST_F(DiskCacheTest, SimpleCacheControlJoin) {
ASSERT_EQ(net::OK, cb.GetResult(rv));
EXPECT_EQ(0, base_cache->GetEntryCount());
}
+#endif
// Tests that the disk cache can restart in the control group preserving
// existing entries.
@@ -1945,6 +1953,9 @@ TEST_F(DiskCacheTest, SimpleCacheControlLeave) {
}
// Tests that the cache is properly restarted on recovery error.
+// Disabled on android since this test requires cache creator to create
+// blockfile caches.
+#if !defined(OS_ANDROID)
TEST_F(DiskCacheBackendTest, DeleteOld) {
ASSERT_TRUE(CopyTestCache("wrong_version"));
SetNewEviction();
@@ -1971,6 +1982,7 @@ TEST_F(DiskCacheBackendTest, DeleteOld) {
cache_.reset();
EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, mask_));
}
+#endif
// We want to be able to deal with messed up entries on disk.
void DiskCacheBackendTest::BackendInvalidEntry2() {
diff --git a/net/disk_cache/cache_creator.cc b/net/disk_cache/cache_creator.cc
index 102e102..866df10 100644
--- a/net/disk_cache/cache_creator.cc
+++ b/net/disk_cache/cache_creator.cc
@@ -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) {
diff --git a/net/disk_cache/simple/simple_histogram_macros.h b/net/disk_cache/simple/simple_histogram_macros.h
index f800a6f..39fdff7 100644
--- a/net/disk_cache/simple/simple_histogram_macros.h
+++ b/net/disk_cache/simple/simple_histogram_macros.h
@@ -16,6 +16,9 @@
#define SIMPLE_CACHE_THUNK(uma_type, args) UMA_HISTOGRAM_##uma_type args
+// TODO(pasko): add histograms for shader cache as soon as it becomes possible
+// for a user to get shader cache with the |SimpleBackendImpl| without altering
+// any flags.
#define SIMPLE_CACHE_UMA(uma_type, uma_name, cache_type, ...) \
do { \
switch (cache_type) { \
@@ -31,6 +34,8 @@
SIMPLE_CACHE_THUNK( \
uma_type, ("SimpleCache.Media." uma_name, ##__VA_ARGS__)); \
break; \
+ case net::SHADER_CACHE: \
+ break; \
default: \
NOTREACHED(); \
break; \