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

Unified Diff: content/browser/background_sync/background_sync_context.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
Index: content/browser/background_sync/background_sync_context.cc
diff --git a/content/browser/background_sync/background_sync_context.cc b/content/browser/background_sync/background_sync_context.cc
index 6a5166a048eb09891711c4e450b2c63acdbf3ce4..c1b920fbe717f5636216e4006aa2fa857bfb3839 100644
--- a/content/browser/background_sync/background_sync_context.cc
+++ b/content/browser/background_sync/background_sync_context.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "content/browser/background_sync/background_sync_manager.h"
#include "content/browser/background_sync/background_sync_service_impl.h"
@@ -55,10 +56,9 @@ void BackgroundSyncContext::CreateService(
void BackgroundSyncContext::ServiceHadConnectionError(
BackgroundSyncServiceImpl* service) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- DCHECK(base::ContainsValue(services_, service));
+ DCHECK(base::ContainsKey(services_, service));
services_.erase(service);
- delete service;
}
BackgroundSyncManager* BackgroundSyncContext::background_sync_manager() const {
@@ -86,13 +86,15 @@ void BackgroundSyncContext::CreateServiceOnIOThread(
mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> request) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(background_sync_manager_);
- services_.insert(new BackgroundSyncServiceImpl(this, std::move(request)));
+ BackgroundSyncServiceImpl* service =
+ new BackgroundSyncServiceImpl(this, std::move(request));
+ services_[service] = base::WrapUnique(service);
}
void BackgroundSyncContext::ShutdownOnIO() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- base::STLDeleteElements(&services_);
+ services_.clear();
background_sync_manager_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698