Adding URLResponse Disk Cache to mojo.
This CL introduces a url response disk cache that allows the shell and content
handlers to access cached response data as file without the need to
stream the full content nor create a new file. It also allows
content handlers to access uncompressed cached archive.
The cache service is loaded internally by the shell because it is used
during application loads.
The android handler is using this service to cache the uncompressed archive of
android applications and the compiled dex files
R=blundell@chromium.org, davemoore@chromium.org
Review URL: https://codereview.chromium.org/1088533003
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc
index e1a6125..abaa11a 100644
--- a/shell/application_manager/application_manager.cc
+++ b/shell/application_manager/application_manager.cc
@@ -178,23 +178,19 @@
parameters);
if (resolved_url.SchemeIsFile()) {
- new LocalFetcher(
- resolved_url, GetBaseURLAndQuery(resolved_url, nullptr),
- base::Bind(callback, NativeApplicationCleanup::DONT_DELETE));
+ new LocalFetcher(resolved_url, GetBaseURLAndQuery(resolved_url, nullptr),
+ callback);
return;
}
- if (!network_service_)
+ if (!network_service_) {
ConnectToService(GURL("mojo:network_service"), &network_service_);
-
- const NativeApplicationCleanup cleanup =
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDontDeleteOnDownload)
- ? NativeApplicationCleanup::DONT_DELETE
- : NativeApplicationCleanup::DELETE;
+ ConnectToService(GURL("mojo:url_response_disk_cache"),
+ &url_response_disk_cache_);
+ }
new NetworkFetcher(disable_cache_, resolved_url, network_service_.get(),
- base::Bind(callback, cleanup));
+ url_response_disk_cache_.get(), callback);
}
bool ApplicationManager::ConnectToRunningApplication(
@@ -274,7 +270,6 @@
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters,
- NativeApplicationCleanup cleanup,
scoped_ptr<Fetcher> fetcher) {
if (!fetcher) {
// Network error. Drop |application_request| to tell requestor.
@@ -342,13 +337,12 @@
blocking_pool_,
base::Bind(&ApplicationManager::RunNativeApplication,
weak_ptr_factory_.GetWeakPtr(), base::Passed(request.Pass()),
- options, cleanup, base::Passed(fetcher.Pass())));
+ options, base::Passed(fetcher.Pass())));
}
void ApplicationManager::RunNativeApplication(
InterfaceRequest<Application> application_request,
const NativeRunnerFactory::Options& options,
- NativeApplicationCleanup cleanup,
scoped_ptr<Fetcher> fetcher,
const base::FilePath& path,
bool path_exists) {
@@ -367,7 +361,7 @@
path.AsUTF8Unsafe());
NativeRunner* runner = native_runner_factory_->Create(options).release();
native_runners_.push_back(runner);
- runner->Start(path, cleanup, application_request.Pass(),
+ runner->Start(path, application_request.Pass(),
base::Bind(&ApplicationManager::CleanupRunner,
weak_ptr_factory_.GetWeakPtr(), runner));
}