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

Unified Diff: content/child/notifications/notification_manager.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years, 1 month 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/child/notifications/notification_manager.h ('k') | content/child/push_messaging/push_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/notifications/notification_manager.cc
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc
index ae02cfcbe2c4687867a39491796c59f8d6cde6a8..cc6ee3e7c33d13d3006885b0e4421862335e742d 100644
--- a/content/child/notifications/notification_manager.cc
+++ b/content/child/notifications/notification_manager.cc
@@ -112,7 +112,7 @@ void NotificationManager::showPersistent(
const blink::WebNotificationData& notification_data,
std::unique_ptr<blink::WebNotificationResources> notification_resources,
blink::WebServiceWorkerRegistration* service_worker_registration,
- blink::WebNotificationShowCallbacks* callbacks) {
+ std::unique_ptr<blink::WebNotificationShowCallbacks> callbacks) {
DCHECK(service_worker_registration);
DCHECK_EQ(notification_data.actions.size(),
notification_resources->actionIcons.size());
@@ -122,9 +122,6 @@ void NotificationManager::showPersistent(
service_worker_registration)
->registrationId();
- std::unique_ptr<blink::WebNotificationShowCallbacks> owned_callbacks(
- callbacks);
-
// Verify that the author-provided payload size does not exceed our limit.
// This is an implementation-defined limit to prevent abuse of notification
// data as a storage mechanism. A UMA histogram records the requested sizes,
@@ -138,7 +135,7 @@ void NotificationManager::showPersistent(
UMA_HISTOGRAM_COUNTS_1000("Notifications.AuthorDataSize", author_data_size);
if (author_data_size > PlatformNotificationData::kMaximumDeveloperDataSize) {
- owned_callbacks->onError();
+ callbacks->onError();
return;
}
@@ -147,7 +144,7 @@ void NotificationManager::showPersistent(
int request_id =
notification_dispatcher_->GenerateNotificationId(CurrentWorkerId());
- pending_show_notification_requests_.AddWithID(owned_callbacks.release(),
+ pending_show_notification_requests_.AddWithID(std::move(callbacks),
request_id);
// TODO(mkwst): This is potentially doing the wrong thing with unique
@@ -162,7 +159,7 @@ void NotificationManager::showPersistent(
void NotificationManager::getNotifications(
const blink::WebString& filter_tag,
blink::WebServiceWorkerRegistration* service_worker_registration,
- blink::WebNotificationGetCallbacks* callbacks) {
+ std::unique_ptr<blink::WebNotificationGetCallbacks> callbacks) {
DCHECK(service_worker_registration);
DCHECK(callbacks);
@@ -179,7 +176,8 @@ void NotificationManager::getNotifications(
int request_id =
notification_dispatcher_->GenerateNotificationId(CurrentWorkerId());
- pending_get_notification_requests_.AddWithID(callbacks, request_id);
+ pending_get_notification_requests_.AddWithID(std::move(callbacks),
+ request_id);
thread_safe_sender_->Send(new PlatformNotificationHostMsg_GetNotifications(
request_id, service_worker_registration_id, origin,
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/child/push_messaging/push_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698