| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/devtools/protocol/service_worker_handler.h" | 5 #include "content/browser/devtools/protocol/service_worker_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 NOTREACHED() << type; | 263 NOTREACHED() << type; |
| 264 return std::string(); | 264 return std::string(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void DidFindRegistrationForDispatchSyncEventOnIO( | 267 void DidFindRegistrationForDispatchSyncEventOnIO( |
| 268 scoped_refptr<BackgroundSyncContext> sync_context, | 268 scoped_refptr<BackgroundSyncContext> sync_context, |
| 269 const std::string& tag, | 269 const std::string& tag, |
| 270 bool last_chance, | 270 bool last_chance, |
| 271 ServiceWorkerStatusCode status, | 271 ServiceWorkerStatusCode status, |
| 272 const scoped_refptr<content::ServiceWorkerRegistration>& registration) { | 272 scoped_refptr<content::ServiceWorkerRegistration> registration) { |
| 273 if (status != SERVICE_WORKER_OK || !registration->active_version()) | 273 if (status != SERVICE_WORKER_OK || !registration->active_version()) |
| 274 return; | 274 return; |
| 275 BackgroundSyncManager* background_sync_manager = | 275 BackgroundSyncManager* background_sync_manager = |
| 276 sync_context->background_sync_manager(); | 276 sync_context->background_sync_manager(); |
| 277 scoped_refptr<content::ServiceWorkerVersion> version( | 277 scoped_refptr<content::ServiceWorkerVersion> version( |
| 278 registration->active_version()); | 278 registration->active_version()); |
| 279 // Keep the registration while dispatching the sync event. | 279 // Keep the registration while dispatching the sync event. |
| 280 background_sync_manager->EmulateDispatchSyncEvent( | 280 background_sync_manager->EmulateDispatchSyncEvent( |
| 281 tag, std::move(version), last_chance, | 281 tag, std::move(version), last_chance, |
| 282 base::Bind(&StatusNoOpKeepingRegistration, registration)); | 282 base::Bind(&StatusNoOpKeepingRegistration, std::move(registration))); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void DispatchSyncEventOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, | 285 void DispatchSyncEventOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, |
| 286 scoped_refptr<BackgroundSyncContext> sync_context, | 286 scoped_refptr<BackgroundSyncContext> sync_context, |
| 287 const GURL& origin, | 287 const GURL& origin, |
| 288 int64_t registration_id, | 288 int64_t registration_id, |
| 289 const std::string& tag, | 289 const std::string& tag, |
| 290 bool last_chance) { | 290 bool last_chance) { |
| 291 context->FindReadyRegistrationForId( | 291 context->FindReadyRegistrationForId( |
| 292 registration_id, origin, | 292 registration_id, origin, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 692 } |
| 693 | 693 |
| 694 void ServiceWorkerHandler::ClearForceUpdate() { | 694 void ServiceWorkerHandler::ClearForceUpdate() { |
| 695 if (context_) | 695 if (context_) |
| 696 context_->SetForceUpdateOnPageLoad(false); | 696 context_->SetForceUpdateOnPageLoad(false); |
| 697 } | 697 } |
| 698 | 698 |
| 699 } // namespace service_worker | 699 } // namespace service_worker |
| 700 } // namespace devtools | 700 } // namespace devtools |
| 701 } // namespace content | 701 } // namespace content |
| OLD | NEW |