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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/service_worker/service_worker_dispatcher.h" 5 #include "content/child/service_worker/service_worker_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 typedef blink::WebVector<blink::WebServiceWorkerRegistration::Handle*> 474 typedef blink::WebVector<blink::WebServiceWorkerRegistration::Handle*>
475 WebServiceWorkerRegistrationArray; 475 WebServiceWorkerRegistrationArray;
476 scoped_ptr<WebServiceWorkerRegistrationArray> registrations( 476 scoped_ptr<WebServiceWorkerRegistrationArray> registrations(
477 new WebServiceWorkerRegistrationArray(infos.size())); 477 new WebServiceWorkerRegistrationArray(infos.size()));
478 for (size_t i = 0; i < infos.size(); ++i) { 478 for (size_t i = 0; i < infos.size(); ++i) {
479 if (infos[i].handle_id != kInvalidServiceWorkerHandleId) { 479 if (infos[i].handle_id != kInvalidServiceWorkerHandleId) {
480 ServiceWorkerRegistrationObjectInfo info(infos[i]); 480 ServiceWorkerRegistrationObjectInfo info(infos[i]);
481 ServiceWorkerVersionAttributes attr(attrs[i]); 481 ServiceWorkerVersionAttributes attr(attrs[i]);
482 482
483 // WebServiceWorkerGetRegistrationsCallbacks cannot receive an array of 483 // WebServiceWorkerGetRegistrationsCallbacks cannot receive an array of
484 // WebPassOwnPtr<WebServiceWorkerRegistration::Handle>, so create leaky 484 // std::unique_ptr<WebServiceWorkerRegistration::Handle>, so create leaky
485 // handles instead. 485 // handles instead.
486 (*registrations)[i] = WebServiceWorkerRegistrationImpl::CreateLeakyHandle( 486 (*registrations)[i] = WebServiceWorkerRegistrationImpl::CreateLeakyHandle(
487 GetOrAdoptRegistration(info, attr)); 487 GetOrAdoptRegistration(info, attr));
488 } 488 }
489 } 489 }
490 490
491 callbacks->onSuccess(blink::adoptWebPtr(registrations.release())); 491 callbacks->onSuccess(std::move(registrations));
492 pending_get_registrations_callbacks_.Remove(request_id); 492 pending_get_registrations_callbacks_.Remove(request_id);
493 } 493 }
494 494
495 void ServiceWorkerDispatcher::OnDidGetRegistrationForReady( 495 void ServiceWorkerDispatcher::OnDidGetRegistrationForReady(
496 int thread_id, 496 int thread_id,
497 int request_id, 497 int request_id,
498 const ServiceWorkerRegistrationObjectInfo& info, 498 const ServiceWorkerRegistrationObjectInfo& info,
499 const ServiceWorkerVersionAttributes& attrs) { 499 const ServiceWorkerVersionAttributes& attrs) {
500 TRACE_EVENT_ASYNC_STEP_INTO0( 500 TRACE_EVENT_ASYNC_STEP_INTO0(
501 "ServiceWorker", 501 "ServiceWorker",
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 return ServiceWorkerRegistrationHandleReference::Adopt( 770 return ServiceWorkerRegistrationHandleReference::Adopt(
771 info, thread_safe_sender_.get()); 771 info, thread_safe_sender_.get());
772 } 772 }
773 773
774 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( 774 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt(
775 const ServiceWorkerObjectInfo& info) { 775 const ServiceWorkerObjectInfo& info) {
776 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); 776 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
777 } 777 }
778 778
779 } // namespace content 779 } // namespace content
OLDNEW
« no previous file with comments | « content/child/push_messaging/push_provider.cc ('k') | content/child/service_worker/service_worker_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698