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

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: Fix typo breaking a bunch of trybot builds, oops 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 92d5424c7d61b2d8e651e358fd278b0a589e9cf8..f89a9014bea0f85e4cdbc13de38e25a6f82bc88b 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -463,7 +463,8 @@ void ServiceWorkerContextClient::getClient(
const blink::WebString& id,
blink::WebServiceWorkerClientCallbacks* callbacks) {
danakj 2016/11/18 00:15:33 samesamesame
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))));
}
@@ -472,7 +473,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;
@@ -484,7 +486,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));
}
@@ -883,7 +886,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))));
@@ -894,7 +898,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));
@@ -903,14 +908,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));
}
@@ -928,8 +935,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.
@@ -1018,8 +1025,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