Commit 8e333b2c authored by Min Qin's avatar Min Qin Committed by Commit Bot

WebUI: Don't check for removed download files when render process is gone

This blocks the history service shutdown.
The issue was originally introduced in https://codereview.chromium.org/1960223002
However, when render process is gone, there is no need to check removed files.
We can do that next time when downloads page is loaded

BUG=477975

Change-Id: I468cabc7d4c564591dfeaf4b0af66290e1ac8f53
Reviewed-on: https://chromium-review.googlesource.com/810107
Commit-Queue: Min Qin(OOO 12/7-1/10) <qinmin@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522207}
parent f0c5b69e
......@@ -75,8 +75,7 @@ void CountDownloadsDOMEvents(DownloadsDOMEvent event) {
MdDownloadsDOMHandler::MdDownloadsDOMHandler(
content::DownloadManager* download_manager, content::WebUI* web_ui)
: list_tracker_(download_manager, web_ui),
weak_ptr_factory_(this) {
: list_tracker_(download_manager, web_ui) {
// Create our fileicon data source.
profile_ = Profile::FromBrowserContext(download_manager->GetBrowserContext());
content::URLDataSource::Add(profile_, new FileIconSource());
......@@ -139,12 +138,14 @@ void MdDownloadsDOMHandler::RegisterMessages() {
void MdDownloadsDOMHandler::OnJavascriptDisallowed() {
list_tracker_.Stop();
list_tracker_.Reset();
if (!render_process_gone_)
CheckForRemovedFiles();
}
void MdDownloadsDOMHandler::RenderProcessGone(base::TerminationStatus status) {
// TODO(dbeam): WebUI + WebUIMessageHandler should do this automatically.
// http://crbug.com/610450
render_process_gone_ = true;
DisallowJavascript();
}
......
......@@ -153,9 +153,12 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver,
std::vector<IdSet> removals_;
// User profile that corresponds to this handler.
Profile* profile_;
Profile* profile_ = nullptr;
base::WeakPtrFactory<MdDownloadsDOMHandler> weak_ptr_factory_;
// Whether the render process has gone.
bool render_process_gone_ = false;
base::WeakPtrFactory<MdDownloadsDOMHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MdDownloadsDOMHandler);
};
......
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