summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorpasko@google.com <pasko@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-13 12:37:44 +0000
committerpasko@google.com <pasko@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-13 12:37:44 +0000
commitfa1d08ea2a17c5555eedbaa862d8ef68dbea8ba5 (patch)
tree3f648bf01127e44b2c5bcc345d7be4129e442b62 /net/http
parentb95e72678f32d52db1c9fbc696fd4f3df825f060 (diff)
downloadchromium_src-fa1d08ea2a17c5555eedbaa862d8ef68dbea8ba5.zip
chromium_src-fa1d08ea2a17c5555eedbaa862d8ef68dbea8ba5.tar.gz
chromium_src-fa1d08ea2a17c5555eedbaa862d8ef68dbea8ba5.tar.bz2
Override server-side simple-cache trial with commandline switches.
FIXING broken about:flags for simple cache on Android. Until recently we used a trick to avoid dedicated global settings in net::disk_cache other than the objects belonging to the infrastructure of the trials. The commandline flag would change the experiment group on the chromium side, while one the net/ side we would check which group we belong to. Later we decided to switch to the server-controlled experiments. This went into a conflict with our approach: the server-controlled experiment would override the settings set by the command-line option. This is unfortunate. Stevet@ suggests that there are plans to avoid overriding the experiment groups by the server config, but in the meantime the trick stops working. Solve this by adding backend type enum provided at backend instantiation. TBR=jam@chromium.org BUG=239461 Review URL: https://chromiumcodereview.appspot.com/14828004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_cache.cc11
-rw-r--r--net/http/http_cache.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 421300e..8905695 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -27,6 +27,7 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/worker_pool.h"
+#include "net/base/cache_type.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -52,10 +53,12 @@ void DeletePath(base::FilePath path) {
namespace net {
HttpCache::DefaultBackend::DefaultBackend(CacheType type,
+ BackendType backend_type,
const base::FilePath& path,
int max_bytes,
base::MessageLoopProxy* thread)
: type_(type),
+ backend_type_(backend_type),
path_(path),
max_bytes_(max_bytes),
thread_(thread) {
@@ -65,15 +68,17 @@ HttpCache::DefaultBackend::~DefaultBackend() {}
// static
HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) {
- return new DefaultBackend(MEMORY_CACHE, base::FilePath(), max_bytes, NULL);
+ return new DefaultBackend(MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT,
+ base::FilePath(), max_bytes, NULL);
}
int HttpCache::DefaultBackend::CreateBackend(
NetLog* net_log, disk_cache::Backend** backend,
const CompletionCallback& callback) {
DCHECK_GE(max_bytes_, 0);
- return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true,
- thread_, net_log, backend, callback);
+ return disk_cache::CreateCacheBackend(type_, backend_type_, path_, max_bytes_,
+ true, thread_, net_log, backend,
+ callback);
}
//-----------------------------------------------------------------------------
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 9e6b73c..fcba80e 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -99,7 +99,8 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
// |path| is the destination for any files used by the backend, and
// |cache_thread| is the thread where disk operations should take place. If
// |max_bytes| is zero, a default value will be calculated automatically.
- DefaultBackend(CacheType type, const base::FilePath& path, int max_bytes,
+ DefaultBackend(CacheType type, BackendType backend_type,
+ const base::FilePath& path, int max_bytes,
base::MessageLoopProxy* thread);
virtual ~DefaultBackend();
@@ -113,6 +114,7 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
private:
CacheType type_;
+ BackendType backend_type_;
const base::FilePath path_;
int max_bytes_;
scoped_refptr<base::MessageLoopProxy> thread_;