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

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

Issue 1146913004: Service Worker: Add ServiceWorkerContainer.getRegistrations() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make GetRegistrationsForOrigin() handle nullptr for resource param. 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_context_core.h" 5 #include "content/browser/service_worker/service_worker_context_core.h"
6 6
7 #include "base/barrier_closure.h" 7 #include "base/barrier_closure.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 void ServiceWorkerContextCore::UnregisterServiceWorkers( 287 void ServiceWorkerContextCore::UnregisterServiceWorkers(
288 const GURL& origin, 288 const GURL& origin,
289 const UnregistrationCallback& callback) { 289 const UnregistrationCallback& callback) {
290 DCHECK_CURRENTLY_ON(BrowserThread::IO); 290 DCHECK_CURRENTLY_ON(BrowserThread::IO);
291 if (storage()->IsDisabled()) { 291 if (storage()->IsDisabled()) {
292 // Not posting as new task to match implementations above. 292 // Not posting as new task to match implementations above.
293 callback.Run(SERVICE_WORKER_ERROR_ABORT); 293 callback.Run(SERVICE_WORKER_ERROR_ABORT);
294 return; 294 return;
295 } 295 }
296 296
297 storage()->GetAllRegistrations(base::Bind( 297 storage()->GetAllRegistrationsInfos(base::Bind(
298 &ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin, 298 &ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin,
299 AsWeakPtr(), 299 AsWeakPtr(), callback, origin));
300 callback,
301 origin));
302 } 300 }
303 301
304 void ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin( 302 void ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin(
305 const UnregistrationCallback& result, 303 const UnregistrationCallback& result,
306 const GURL& origin, 304 const GURL& origin,
307 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { 305 const std::vector<ServiceWorkerRegistrationInfo>& registrations) {
308 std::set<GURL> scopes; 306 std::set<GURL> scopes;
309 for (const auto& registration_info : registrations) { 307 for (const auto& registration_info : registrations) {
310 if (origin == registration_info.pattern.GetOrigin()) { 308 if (origin == registration_info.pattern.GetOrigin()) {
311 scopes.insert(registration_info.pattern); 309 scopes.insert(registration_info.pattern);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 version->embedded_worker()->thread_id(), 547 version->embedded_worker()->thread_id(),
550 ServiceWorkerContextObserver::ConsoleMessage( 548 ServiceWorkerContextObserver::ConsoleMessage(
551 source_identifier, message_level, message, line_number, source_url)); 549 source_identifier, message_level, message, line_number, source_url));
552 } 550 }
553 551
554 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { 552 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() {
555 return wrapper_->process_manager(); 553 return wrapper_->process_manager();
556 } 554 }
557 555
558 } // namespace content 556 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698