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

Side by Side Diff: content/browser/service_worker/service_worker_controllee_request_handler.cc

Issue 2181553003: Stop passing const-reference of SWRegistration in all GetRegistrationsCallbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ServiceWorkerContextCore::DidFindRegistrationForCheckHasServiceWorker() Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/service_worker/service_worker_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 provider_host_->SetAllowAssociation(false); 169 provider_host_->SetAllowAssociation(false);
170 170
171 stripped_url_ = net::SimplifyUrlForRequest(request->url()); 171 stripped_url_ = net::SimplifyUrlForRequest(request->url());
172 provider_host_->SetDocumentUrl(stripped_url_); 172 provider_host_->SetDocumentUrl(stripped_url_);
173 provider_host_->SetTopmostFrameUrl(request->first_party_for_cookies()); 173 provider_host_->SetTopmostFrameUrl(request->first_party_for_cookies());
174 context_->storage()->FindRegistrationForDocument( 174 context_->storage()->FindRegistrationForDocument(
175 stripped_url_, base::Bind(&self::DidLookupRegistrationForMainResource, 175 stripped_url_, base::Bind(&self::DidLookupRegistrationForMainResource,
176 weak_factory_.GetWeakPtr())); 176 weak_factory_.GetWeakPtr()));
177 } 177 }
178 178
179 void 179 void ServiceWorkerControlleeRequestHandler::
180 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( 180 DidLookupRegistrationForMainResource(
181 ServiceWorkerStatusCode status, 181 ServiceWorkerStatusCode status,
182 const scoped_refptr<ServiceWorkerRegistration>& registration) { 182 scoped_refptr<ServiceWorkerRegistration> registration) {
183 // The job may have been canceled and then destroyed before this was invoked. 183 // The job may have been canceled and then destroyed before this was invoked.
184 if (!job_) 184 if (!job_)
185 return; 185 return;
186 186
187 const bool need_to_update = !force_update_started_ && registration && 187 const bool need_to_update = !force_update_started_ && registration &&
188 context_->force_update_on_page_load(); 188 context_->force_update_on_page_load();
189 189
190 if (provider_host_ && !need_to_update) 190 if (provider_host_ && !need_to_update)
191 provider_host_->SetAllowAssociation(true); 191 provider_host_->SetAllowAssociation(true);
192 if (status != SERVICE_WORKER_OK || !provider_host_ || !context_) { 192 if (status != SERVICE_WORKER_OK || !provider_host_ || !context_) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DCHECK(provider_host_); 423 DCHECK(provider_host_);
424 // Detach the controller so subresource requests also skip the worker. 424 // Detach the controller so subresource requests also skip the worker.
425 provider_host_->NotifyControllerLost(); 425 provider_host_->NotifyControllerLost();
426 } 426 }
427 427
428 void ServiceWorkerControlleeRequestHandler::ClearJob() { 428 void ServiceWorkerControlleeRequestHandler::ClearJob() {
429 job_.reset(); 429 job_.reset();
430 } 430 }
431 431
432 } // namespace content 432 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698