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

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

Issue 2435863004: Remove stl_util's deletion function use from content/. (Closed)
Patch Set: minus service worker Created 4 years, 2 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') | content/browser/download/save_file_manager.h » ('j') | 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 77c038285fafbfbc33f28488b5da3fa563547dd7..0be80421848d9e92fbf576b7268370ac301841d6 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -12,6 +12,7 @@
#include "base/files/file.h"
#include "base/guid.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/scoped_observer.h"
#include "base/stl_util.h"
@@ -391,7 +392,6 @@ MHTMLGenerationManager* MHTMLGenerationManager::GetInstance() {
MHTMLGenerationManager::MHTMLGenerationManager() : next_job_id_(0) {}
MHTMLGenerationManager::~MHTMLGenerationManager() {
- base::STLDeleteValues(&id_to_job_);
}
void MHTMLGenerationManager::SaveMHTML(WebContents* web_contents,
@@ -513,7 +513,6 @@ void MHTMLGenerationManager::OnFileClosed(int job_id,
base::TimeTicks::Now() - job->creation_time());
job->callback().Run(job_status == JobStatus::SUCCESS ? file_size : -1);
id_to_job_.erase(job_id);
- delete job;
}
MHTMLGenerationManager::Job* MHTMLGenerationManager::NewJob(
@@ -523,19 +522,19 @@ MHTMLGenerationManager::Job* MHTMLGenerationManager::NewJob(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Job* job = new Job(++next_job_id_, web_contents, params, callback);
- id_to_job_[job->id()] = job;
+ id_to_job_[job->id()] = base::WrapUnique(job);
return job;
}
MHTMLGenerationManager::Job* MHTMLGenerationManager::FindJob(int job_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- IDToJobMap::iterator iter = id_to_job_.find(job_id);
+ auto iter = id_to_job_.find(job_id);
if (iter == id_to_job_.end()) {
NOTREACHED();
return nullptr;
}
- return iter->second;
+ return iter->second.get();
}
void MHTMLGenerationManager::RenderProcessExited(Job* job) {
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | content/browser/download/save_file_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698