Add --disable-http-cache switch, fixes #891

This commit is contained in:
Cheng Zhao 2015-01-05 13:40:38 -08:00
Родитель 895ccf69a7
Коммит d65919d896
6 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -8,6 +8,8 @@
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/browser/net/asar/asar_protocol_handler.h"
#include "atom/browser/web_view/web_view_manager.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/worker_pool.h"
#include "chrome/browser/browser_process.h"
@ -26,6 +28,14 @@ namespace {
const char* kAsarScheme = "asar";
class NoCacheBackend : public net::HttpCache::BackendFactory {
int CreateBackend(net::NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
const net::CompletionCallback& callback) override {
return net::ERR_FAILED;
}
};
} // namespace
AtomBrowserContext::AtomBrowserContext()
@ -69,6 +79,16 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
return top_job_factory.release();
}
net::HttpCache::BackendFactory*
AtomBrowserContext::CreateHttpCacheBackendFactory(
const base::FilePath& base_path) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableHttpCache))
return new NoCacheBackend;
else
return brightray::BrowserContext::CreateHttpCacheBackendFactory(base_path);
}
content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
if (!guest_manager_)
guest_manager_.reset(new WebViewManager(this));

Просмотреть файл

@ -26,6 +26,8 @@ class AtomBrowserContext : public brightray::BrowserContext {
net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) override;
net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path) override;
// content::BrowserContext:
content::BrowserPluginGuestManager* GetGuestManager() override;

Просмотреть файл

@ -77,6 +77,9 @@ const char kOverlayScrollbars[] = "overlay-scrollbars";
const char kOverlayFullscreenVideo[] = "overlay-fullscreen-video";
const char kSharedWorker[] = "shared-worker";
// Disable HTTP cache.
const char kDisableHttpCache[] = "disable-http-cache";
} // namespace switches
} // namespace atom

Просмотреть файл

@ -47,6 +47,8 @@ extern const char kOverlayScrollbars[];
extern const char kOverlayFullscreenVideo[];
extern const char kSharedWorker[];
extern const char kDisableHttpCache[];
} // namespace switches
} // namespace atom

Просмотреть файл

@ -14,6 +14,10 @@ app.on('ready', function() {
});
```
## --disable-http-cache
Disables the disk cache for HTTP requests.
## --remote-debugging-port=`port`
Enables remote debug over HTTP on the specified `port`.

2
vendor/brightray поставляемый

@ -1 +1 @@
Subproject commit ecda2421fbe41113d47a897f6656a740dc2d2dc3
Subproject commit bae4765d993cda6507829961bef5edc59028edca