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

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

Issue 1181573010: ServiceWorker: Fix matching registration info missing during shift-reload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/browser/service_worker/service_worker_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 for (; it != matching_registrations_.rend(); ++it) { 295 for (; it != matching_registrations_.rend(); ++it) {
296 if (it->second->is_uninstalled()) 296 if (it->second->is_uninstalled())
297 continue; 297 continue;
298 if (it->second->is_uninstalling()) 298 if (it->second->is_uninstalling())
299 return nullptr; 299 return nullptr;
300 return it->second.get(); 300 return it->second.get();
301 } 301 }
302 return nullptr; 302 return nullptr;
303 } 303 }
304 304
305 void ServiceWorkerProviderHost::CopyMatchingRegistrations() {
306 for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
307 context_->GetProviderHostIterator();
308 !it->IsAtEnd(); it->Advance()) {
309 ServiceWorkerProviderHost* host = it->GetProviderHost();
michaeln 2015/06/17 21:20:14 need to compare host process_ids as well
xiang 2015/06/19 07:43:24 Done.
310 if (host->render_frame_id_ != render_frame_id_)
311 continue;
312 if (host->document_url_ != document_url_)
313 continue;
falken 2015/06/17 15:08:35 I wonder if we can really be sure an old provider
michaeln 2015/06/17 21:20:14 In the reload case, there will be an old provider,
xiang 2015/06/19 07:43:24 I feel finding the old SWPH maybe faster than get
michaeln 2015/06/22 20:33:52 I think agree with falken about doing this as AddM
xiang 2015/06/23 09:01:36 Thanks for the suggestion, CL changed.
314 for (auto& key_registration : host->matching_registrations_)
315 AddMatchingRegistration(key_registration.second.get());
316 break;
317 }
318 }
319
305 void ServiceWorkerProviderHost::NotifyControllerLost() { 320 void ServiceWorkerProviderHost::NotifyControllerLost() {
306 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); 321 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */);
307 } 322 }
308 323
309 scoped_ptr<ServiceWorkerRequestHandler> 324 scoped_ptr<ServiceWorkerRequestHandler>
310 ServiceWorkerProviderHost::CreateRequestHandler( 325 ServiceWorkerProviderHost::CreateRequestHandler(
311 FetchRequestMode request_mode, 326 FetchRequestMode request_mode,
312 FetchCredentialsMode credentials_mode, 327 FetchCredentialsMode credentials_mode,
313 ResourceType resource_type, 328 ResourceType resource_type,
314 RequestContextType request_context_type, 329 RequestContextType request_context_type,
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 return context_ != NULL; 665 return context_ != NULL;
651 } 666 }
652 667
653 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { 668 void ServiceWorkerProviderHost::Send(IPC::Message* message) const {
654 DCHECK(dispatcher_host_); 669 DCHECK(dispatcher_host_);
655 DCHECK(IsReadyToSendMessages()); 670 DCHECK(IsReadyToSendMessages());
656 dispatcher_host_->Send(message); 671 dispatcher_host_->Send(message);
657 } 672 }
658 673
659 } // namespace content 674 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698