Chromium Code Reviews| 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, |