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

Unified Diff: content/browser/download/mhtml_generation_manager.cc

Issue 21512003: MHTMLGenerationManager handles the death of a render process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Makes android builder happy. Created 7 years, 4 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
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/mhtml_generation_manager.cc
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index d6a0d474b3861cd1e909094d0f5a98d9e18ca8ae..c4bc378c1480907cb61800114c0b788e3d376077 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -50,6 +50,15 @@ void MHTMLGenerationManager::GenerateMHTML(
job.routing_id = web_contents->GetRenderViewHost()->GetRoutingID();
job.callback = callback;
id_to_job_[job_id] = job;
+ if (!registrar_.IsRegistered(
+ this,
+ NOTIFICATION_RENDERER_PROCESS_TERMINATED,
+ Source<RenderProcessHost>(web_contents->GetRenderProcessHost()))) {
+ registrar_.Add(
+ this,
+ NOTIFICATION_RENDERER_PROCESS_TERMINATED,
+ Source<RenderProcessHost>(web_contents->GetRenderProcessHost()));
+ }
base::ProcessHandle renderer_process =
web_contents->GetRenderProcessHost()->GetHandle();
@@ -136,4 +145,26 @@ void MHTMLGenerationManager::CloseFile(base::PlatformFile file) {
base::ClosePlatformFile(file);
}
+void MHTMLGenerationManager::Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED);
+ RenderProcessHost* host = Source<RenderProcessHost>(source).ptr();
+ registrar_.Remove(
+ this,
+ NOTIFICATION_RENDERER_PROCESS_TERMINATED,
+ source);
+ std::set<int> job_to_delete;
+ for (IDToJobMap::iterator it = id_to_job_.begin(); it != id_to_job_.end();
+ ++it) {
+ if (it->second.process_id == host->GetID())
+ job_to_delete.insert(it->first);
+ }
+ for (std::set<int>::iterator it = job_to_delete.begin();
+ it != job_to_delete.end();
+ ++it) {
+ JobFinished(*it, -1);
+ }
+}
+
} // namespace content
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698