Merge pull request #9435 from electron/disk-cache-size-flag
support --disk-cache-size flag
This commit is contained in:
commit
c7e6cbcf9f
4 changed files with 15 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/threading/sequenced_worker_pool.h"
|
#include "base/threading/sequenced_worker_pool.h"
|
||||||
#include "base/threading/worker_pool.h"
|
#include "base/threading/worker_pool.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
@ -92,12 +93,17 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
|
||||||
net::HttpCache::BackendFactory*
|
net::HttpCache::BackendFactory*
|
||||||
URLRequestContextGetter::Delegate::CreateHttpCacheBackendFactory(
|
URLRequestContextGetter::Delegate::CreateHttpCacheBackendFactory(
|
||||||
const base::FilePath& base_path) {
|
const base::FilePath& base_path) {
|
||||||
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
int max_size = 0;
|
||||||
|
base::StringToInt(command_line->GetSwitchValueASCII(switches::kDiskCacheSize),
|
||||||
|
&max_size);
|
||||||
|
|
||||||
base::FilePath cache_path = base_path.Append(FILE_PATH_LITERAL("Cache"));
|
base::FilePath cache_path = base_path.Append(FILE_PATH_LITERAL("Cache"));
|
||||||
return new net::HttpCache::DefaultBackend(
|
return new net::HttpCache::DefaultBackend(
|
||||||
net::DISK_CACHE,
|
net::DISK_CACHE,
|
||||||
net::CACHE_BACKEND_DEFAULT,
|
net::CACHE_BACKEND_DEFAULT,
|
||||||
cache_path,
|
cache_path,
|
||||||
0,
|
max_size,
|
||||||
BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE));
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ const char kAuthNegotiateDelegateWhitelist[] =
|
||||||
// Ignores certificate-related errors.
|
// Ignores certificate-related errors.
|
||||||
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";
|
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";
|
||||||
|
|
||||||
|
// Forces the maximum disk space to be used by the disk cache, in bytes.
|
||||||
|
const char kDiskCacheSize[] = "disk-cache-size";
|
||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern const char kDisableHttp2[];
|
||||||
extern const char kAuthServerWhitelist[];
|
extern const char kAuthServerWhitelist[];
|
||||||
extern const char kAuthNegotiateDelegateWhitelist[];
|
extern const char kAuthNegotiateDelegateWhitelist[];
|
||||||
extern const char kIgnoreCertificateErrors[];
|
extern const char kIgnoreCertificateErrors[];
|
||||||
|
extern const char kDiskCacheSize[];
|
||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@ Debug-related flags, see the [Debugging the Main Process][debugging-main-process
|
||||||
|
|
||||||
Enables remote debugging over HTTP on the specified `port`.
|
Enables remote debugging over HTTP on the specified `port`.
|
||||||
|
|
||||||
|
## --disk-cache-size=`size`
|
||||||
|
|
||||||
|
Forces the maximum disk space to be used by the disk cache, in bytes.
|
||||||
|
|
||||||
## --js-flags=`flags`
|
## --js-flags=`flags`
|
||||||
|
|
||||||
Specifies the flags passed to the Node JS engine. It has to be passed when starting
|
Specifies the flags passed to the Node JS engine. It has to be passed when starting
|
||||||
|
|
Loading…
Add table
Reference in a new issue