Skip to content

Commit

Permalink
wolvic: Enable disk cache
Browse files Browse the repository at this point in the history
This commit enables disk cache directory for the current user profile.
To verify the correctness one can check that the index files are being
created e.g.:

  $ adb shell run-as com.igalia.wolvic
  find -type f | grep Cache
  ./app_content_shell/content_shell/Cache/Cache_Data/*

This was tested with Oculus Quest 2 (Oculus API) and S21 (No API)
devices.

Worth mentioning that Content Shell, in the upstream, could benefit from
a very similar change in
content/shell/browser/shell_content_browser_client.cc.
  • Loading branch information
tiagovignatti authored and svillar committed Oct 3, 2023
1 parent 740e6bc commit 597e3fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions wolvic/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ shared_library("libcontent_native") {
"//components/crash/content/browser",
"//device/vr:vr_util",
"//media",
"//services/network/public/mojom",
"//skia",
]

Expand Down
15 changes: 15 additions & 0 deletions wolvic/wolvic_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

#include "wolvic/wolvic_content_browser_client.h"

#include "base/path_service.h"
#include "components/embedder_support/user_agent_utils.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/user_level_memory_pressure_signal_features.h"
#include "content/public/common/content_switches.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_devtools_manager_delegate.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "wolvic/browser/session_settings.h"
#include "wolvic/browser/youtube/youtube_url_loader_request_interceptor.h"
#include "wolvic/wolvic_browser_context.h"
Expand Down Expand Up @@ -97,6 +99,19 @@ blink::UserAgentMetadata WolvicContentBrowserClient::GetUserAgentMetadata() {
return metadata;
}

void WolvicContentBrowserClient::ConfigureNetworkContextParams(
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) {
base::FilePath user_data_path;
base::PathService::Get(SHELL_DIR_USER_DATA, &user_data_path);
network_context_params->http_cache_directory =
user_data_path.Append(FILE_PATH_LITERAL("Cache"));
}

void WolvicContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
Expand Down
7 changes: 7 additions & 0 deletions wolvic/wolvic_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ class WolvicContentBrowserClient : public ContentBrowserClient {
// ContentBrowserClient overrides.
std::string GetUserAgent() override;
blink::UserAgentMetadata GetUserAgentMetadata() override;
void ConfigureNetworkContextParams(
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) override;
std::unique_ptr<BrowserMainParts> CreateBrowserMainParts(
bool is_integration_test) override;
std::unique_ptr<content::DevToolsManagerDelegate>
Expand Down

0 comments on commit 597e3fd

Please sign in to comment.