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

Unified Diff: content/renderer/service_worker/service_worker_context_client.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: 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
Index: content/renderer/service_worker/service_worker_context_client.cc
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index f76e81dbe660899a2d5904ad16242c7ea2a8af31..58df9f66dec384136f20b9d4649c012a9c3eee02 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -458,7 +458,8 @@ void ServiceWorkerContextClient::getClient(
const blink::WebString& id,
blink::WebServiceWorkerClientCallbacks* callbacks) {
DCHECK(callbacks);
- int request_id = context_->client_callbacks.Add(callbacks);
+ int request_id = context_->client_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientCallbacks>(callbacks));
Send(new ServiceWorkerHostMsg_GetClient(
GetRoutingID(), request_id, base::UTF16ToUTF8(base::StringPiece16(id))));
}
@@ -467,7 +468,8 @@ void ServiceWorkerContextClient::getClients(
const blink::WebServiceWorkerClientQueryOptions& weboptions,
blink::WebServiceWorkerClientsCallbacks* callbacks) {
DCHECK(callbacks);
- int request_id = context_->clients_callbacks.Add(callbacks);
+ int request_id = context_->clients_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientsCallbacks>(callbacks));
ServiceWorkerClientQueryOptions options;
options.client_type = weboptions.clientType;
options.include_uncontrolled = weboptions.includeUncontrolled;
@@ -479,7 +481,8 @@ void ServiceWorkerContextClient::openWindow(
const blink::WebURL& url,
blink::WebServiceWorkerClientCallbacks* callbacks) {
DCHECK(callbacks);
- int request_id = context_->client_callbacks.Add(callbacks);
+ int request_id = context_->client_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientCallbacks>(callbacks));
Send(new ServiceWorkerHostMsg_OpenWindow(
GetRoutingID(), request_id, url));
}
@@ -878,7 +881,8 @@ void ServiceWorkerContextClient::focus(
const blink::WebString& uuid,
blink::WebServiceWorkerClientCallbacks* callback) {
DCHECK(callback);
- int request_id = context_->client_callbacks.Add(callback);
+ int request_id = context_->client_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientCallbacks>(callback));
Send(new ServiceWorkerHostMsg_FocusClient(
GetRoutingID(), request_id,
base::UTF16ToUTF8(base::StringPiece16(uuid))));
@@ -889,7 +893,8 @@ void ServiceWorkerContextClient::navigate(
const blink::WebURL& url,
blink::WebServiceWorkerClientCallbacks* callback) {
DCHECK(callback);
- int request_id = context_->client_callbacks.Add(callback);
+ int request_id = context_->client_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientCallbacks>(callback));
Send(new ServiceWorkerHostMsg_NavigateClient(
GetRoutingID(), request_id, base::UTF16ToUTF8(base::StringPiece16(uuid)),
url));
@@ -898,14 +903,16 @@ void ServiceWorkerContextClient::navigate(
void ServiceWorkerContextClient::skipWaiting(
blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) {
DCHECK(callbacks);
- int request_id = context_->skip_waiting_callbacks.Add(callbacks);
+ int request_id = context_->skip_waiting_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>(callbacks));
Send(new ServiceWorkerHostMsg_SkipWaiting(GetRoutingID(), request_id));
}
void ServiceWorkerContextClient::claim(
blink::WebServiceWorkerClientsClaimCallbacks* callbacks) {
DCHECK(callbacks);
- int request_id = context_->claim_clients_callbacks.Add(callbacks);
+ int request_id = context_->claim_clients_callbacks.Add(
+ std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks>(callbacks));
Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id));
}
@@ -923,8 +930,8 @@ void ServiceWorkerContextClient::DispatchSyncEvent(
const SyncCallback& callback) {
TRACE_EVENT0("ServiceWorker",
"ServiceWorkerContextClient::DispatchSyncEvent");
- int request_id =
- context_->sync_event_callbacks.Add(new SyncCallback(callback));
+ int request_id = context_->sync_event_callbacks.Add(
+ base::MakeUnique<SyncCallback>(callback));
// TODO(jkarlin): Make this blink::WebString::FromUTF8Lenient once
// https://crrev.com/1768063002/ lands.
@@ -1013,8 +1020,8 @@ void ServiceWorkerContextClient::DispatchFetchEvent(
blink::WebServiceWorkerRequest webRequest;
TRACE_EVENT0("ServiceWorker",
"ServiceWorkerContextClient::DispatchFetchEvent");
- context_->fetch_event_callbacks.AddWithID(new FetchCallback(callback),
- fetch_event_id);
+ context_->fetch_event_callbacks.AddWithID(
+ base::MakeUnique<FetchCallback>(callback), fetch_event_id);
if (preload_request) {
context_->preload_requests.AddWithID(std::move(preload_request),
fetch_event_id);

Powered by Google App Engine
This is Rietveld 408576698