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

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: Update tools/metrics/histograms/histograms.xml. 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 void ServiceWorkerContextCore::UnregisterServiceWorkers( 289 void ServiceWorkerContextCore::UnregisterServiceWorkers(
290 const GURL& origin, 290 const GURL& origin,
291 const UnregistrationCallback& callback) { 291 const UnregistrationCallback& callback) {
292 DCHECK_CURRENTLY_ON(BrowserThread::IO); 292 DCHECK_CURRENTLY_ON(BrowserThread::IO);
293 if (storage()->IsDisabled()) { 293 if (storage()->IsDisabled()) {
294 // Not posting as new task to match implementations above. 294 // Not posting as new task to match implementations above.
295 callback.Run(SERVICE_WORKER_ERROR_ABORT); 295 callback.Run(SERVICE_WORKER_ERROR_ABORT);
296 return; 296 return;
297 } 297 }
298 298
299 storage()->GetAllRegistrations(base::Bind( 299 storage()->GetAllRegistrationsInfos(base::Bind(
300 &ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin, 300 &ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin,
301 AsWeakPtr(), 301 AsWeakPtr(), callback, origin));
302 callback,
303 origin));
304 } 302 }
305 303
306 void ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin( 304 void ServiceWorkerContextCore::DidGetAllRegistrationsForUnregisterForOrigin(
307 const UnregistrationCallback& result, 305 const UnregistrationCallback& result,
308 const GURL& origin, 306 const GURL& origin,
309 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { 307 const std::vector<ServiceWorkerRegistrationInfo>& registrations) {
310 std::set<GURL> scopes; 308 std::set<GURL> scopes;
311 for (const auto& registration_info : registrations) { 309 for (const auto& registration_info : registrations) {
312 if (origin == registration_info.pattern.GetOrigin()) { 310 if (origin == registration_info.pattern.GetOrigin()) {
313 scopes.insert(registration_info.pattern); 311 scopes.insert(registration_info.pattern);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 version->embedded_worker()->thread_id(), 552 version->embedded_worker()->thread_id(),
555 ServiceWorkerContextObserver::ConsoleMessage( 553 ServiceWorkerContextObserver::ConsoleMessage(
556 source_identifier, message_level, message, line_number, source_url)); 554 source_identifier, message_level, message, line_number, source_url));
557 } 555 }
558 556
559 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { 557 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() {
560 return wrapper_->process_manager(); 558 return wrapper_->process_manager();
561 } 559 }
562 560
563 } // namespace content 561 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698