Commit f43d70be authored by Andrey Lushnikov's avatar Andrey Lushnikov Committed by Commit Bot

headless: support --disk-cache-dir flag

The --disk-cache-dir flag allows to use custom disk cache folder instead
of using the one inferred from user data directory.

BUG=882431
R=caseq

Change-Id: I2da7e1c4b72eda32bccf6851c66ce44c1aaa837d
Reviewed-on: https://chromium-review.googlesource.com/c/1359038Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613297}
parent 6917b4e7
......@@ -34,6 +34,10 @@ const char kCrashDumpsDir[] = "crash-dumps-dir";
// (experimental).
const char kDeterministicMode[] = "deterministic-mode";
// Use a specific disk cache location, rather than one derived from the
// UserDatadir.
const char kDiskCacheDir[] = "disk-cache-dir";
// Instructs headless_shell to print document.body.innerHTML to stdout.
const char kDumpDom[] = "dump-dom";
......
......@@ -16,6 +16,7 @@ HEADLESS_EXPORT extern const char kDefaultBackgroundColor[];
HEADLESS_EXPORT extern const char kDeterministicMode[];
HEADLESS_EXPORT extern const char kDisableCookieEncryption[];
HEADLESS_EXPORT extern const char kDisableCrashReporter[];
HEADLESS_EXPORT extern const char kDiskCacheDir[];
HEADLESS_EXPORT extern const char kDumpDom[];
HEADLESS_EXPORT extern const char kEnableBeginFrameControl[];
HEADLESS_EXPORT extern const char kEnableCrashReporter[];
......
......@@ -397,6 +397,12 @@ HeadlessRequestContextManager::CreateNetworkContextParams() {
user_data_path_.Append(FILE_PATH_LITERAL("Cookies"));
context_params->channel_id_path =
user_data_path_.Append(FILE_PATH_LITERAL("Origin Bound Certs"));
}
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDiskCacheDir)) {
context_params->http_cache_path =
command_line->GetSwitchValuePath(switches::kDiskCacheDir);
} else if (!user_data_path_.empty()) {
context_params->http_cache_path =
user_data_path_.Append(FILE_PATH_LITERAL("Cache"));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment