Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: shell/dynamic_application_loader.cc

Issue 865253002: Delete temporary application file as soon as the application is launched. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: shell/dynamic_application_loader.cc
diff --git a/shell/dynamic_application_loader.cc b/shell/dynamic_application_loader.cc
index ca63e6f6b73bc9c1ca8b340cb88604221e0db42a..ea7115e85c283d67f32124b3f1fd336ba684b3b2 100644
--- a/shell/dynamic_application_loader.cc
+++ b/shell/dynamic_application_loader.cc
@@ -53,13 +53,15 @@ void IgnoreResult(bool result) {
// while the async operation is outstanding.
class DynamicApplicationLoader::Loader {
public:
- Loader(MimeTypeToURLMap* mime_type_to_url,
+ Loader(DynamicServiceRunner::CleanupBehavior cleanup_behavior,
+ MimeTypeToURLMap* mime_type_to_url,
Context* context,
DynamicServiceRunnerFactory* runner_factory,
ScopedMessagePipeHandle shell_handle,
ApplicationLoader::LoadCallback load_callback,
const LoaderCompleteCallback& loader_complete_callback)
- : shell_handle_(shell_handle.Pass()),
+ : cleanup_behavior_(cleanup_behavior),
+ shell_handle_(shell_handle.Pass()),
load_callback_(load_callback),
loader_complete_callback_(loader_complete_callback),
context_(context),
@@ -112,7 +114,7 @@ class DynamicApplicationLoader::Loader {
base::Bind(&Loader::RunLibrary, weak_ptr_factory_.GetWeakPtr()));
}
- virtual void ReportComplete() { loader_complete_callback_.Run(this); }
+ void ReportComplete() { loader_complete_callback_.Run(this); }
private:
bool PeekContentHandler(std::string* mojo_shebang,
@@ -141,10 +143,11 @@ class DynamicApplicationLoader::Loader {
runner_ = runner_factory_->Create(context_);
runner_->Start(
- path, shell_handle_.Pass(),
+ path, cleanup_behavior_, shell_handle_.Pass(),
base::Bind(&Loader::ReportComplete, weak_ptr_factory_.GetWeakPtr()));
}
+ DynamicServiceRunner::CleanupBehavior cleanup_behavior_;
ScopedMessagePipeHandle shell_handle_;
ApplicationLoader::LoadCallback load_callback_;
LoaderCompleteCallback loader_complete_callback_;
@@ -165,7 +168,8 @@ class DynamicApplicationLoader::LocalLoader : public Loader {
ScopedMessagePipeHandle shell_handle,
ApplicationLoader::LoadCallback load_callback,
const LoaderCompleteCallback& loader_complete_callback)
- : Loader(mime_type_to_url,
+ : Loader(DynamicServiceRunner::DontDeleteAppPath,
+ mime_type_to_url,
context,
runner_factory,
shell_handle.Pass(),
@@ -253,7 +257,8 @@ class DynamicApplicationLoader::NetworkLoader : public Loader {
ScopedMessagePipeHandle shell_handle,
ApplicationLoader::LoadCallback load_callback,
const LoaderCompleteCallback& loader_complete_callback)
- : Loader(mime_type_to_url,
+ : Loader(DynamicServiceRunner::DeleteAppPath,
+ mime_type_to_url,
context,
runner_factory,
shell_handle.Pass(),
@@ -428,14 +433,6 @@ class DynamicApplicationLoader::NetworkLoader : public Loader {
Load();
}
- void ReportComplete() override {
- Loader::ReportComplete();
- // As soon as we've loaded the library we can delete the cache file.
- // Tools can read the mojo_shell.PID.maps file to find the original library.
- if (!path_.empty())
- DeleteFile(path_, false);
- }
-
const GURL url_;
URLLoaderPtr url_loader_;
URLResponsePtr response_;

Powered by Google App Engine
This is Rietveld 408576698