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

Unified Diff: content/browser/appcache/appcache_storage.cc

Issue 2249473002: Remove use of stl_util's STLDeleteContainerPairSecondPointers from content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: p2p Created 4 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
Index: content/browser/appcache/appcache_storage.cc
diff --git a/content/browser/appcache/appcache_storage.cc b/content/browser/appcache/appcache_storage.cc
index d5bec16a5efb4900e213a4a6d2eb92ef0f072b16..7fe9c16e5e57951d98f537b2fbed7db641dd4a22 100644
--- a/content/browser/appcache/appcache_storage.cc
+++ b/content/browser/appcache/appcache_storage.cc
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "content/browser/appcache/appcache_response.h"
#include "content/browser/appcache/appcache_service_impl.h"
#include "storage/browser/quota/quota_client.h"
@@ -23,7 +23,6 @@ AppCacheStorage::AppCacheStorage(AppCacheServiceImpl* service)
}
AppCacheStorage::~AppCacheStorage() {
- base::STLDeleteValues(&pending_info_loads_);
DCHECK(delegate_references_.empty());
}
@@ -47,8 +46,8 @@ AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask(
manifest_url_(manifest_url),
response_id_(response_id),
info_buffer_(new HttpResponseInfoIOBuffer) {
- storage_->pending_info_loads_.insert(
- PendingResponseInfoLoads::value_type(response_id, this));
+ storage_->pending_info_loads_.insert(PendingResponseInfoLoads::value_type(
ncarter (slow) 2016/08/15 21:51:33 Does map::emplace(key, value) work here (letting y
Avi (use Gerrit) 2016/08/15 23:46:49 Nice, and it lets me drop the typedef.
Avi (use Gerrit) 2016/08/16 14:59:02 No, unfortunately map::emplace doesn't exist on th
ncarter (slow) 2016/08/16 18:41:19 Sorry for the wild goose chase, then. At least we
+ response_id, base::WrapUnique(this)));
}
AppCacheStorage::ResponseInfoLoadTask::~ResponseInfoLoadTask() {
@@ -64,7 +63,10 @@ void AppCacheStorage::ResponseInfoLoadTask::StartIfNeeded() {
}
void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) {
+ std::unique_ptr<ResponseInfoLoadTask> this_wrapper(
+ std::move(storage_->pending_info_loads_[response_id_]));
storage_->pending_info_loads_.erase(response_id_);
+
scoped_refptr<AppCacheResponseInfo> info;
if (result >= 0) {
info = new AppCacheResponseInfo(storage_, manifest_url_,
@@ -73,7 +75,8 @@ void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) {
info_buffer_->response_data_size);
}
FOR_EACH_DELEGATE(delegates_, OnResponseInfoLoaded(info.get(), response_id_));
- delete this;
+
+ // returning deletes this
}
void AppCacheStorage::LoadResponseInfo(const GURL& manifest_url,

Powered by Google App Engine
This is Rietveld 408576698