OLD | NEW |
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_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 new_version()->SetStatus(ServiceWorkerVersion::INSTALLING); | 370 new_version()->SetStatus(ServiceWorkerVersion::INSTALLING); |
371 | 371 |
372 // "Resolve registrationPromise with registration." | 372 // "Resolve registrationPromise with registration." |
373 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); | 373 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); |
374 | 374 |
375 // "Fire a simple event named updatefound..." | 375 // "Fire a simple event named updatefound..." |
376 registration()->NotifyUpdateFound(); | 376 registration()->NotifyUpdateFound(); |
377 | 377 |
378 // "Fire an event named install..." | 378 // "Fire an event named install..." |
379 new_version()->DispatchInstallEvent( | 379 new_version()->DispatchInstallEvent( |
380 -1, | |
381 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished, | 380 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished, |
382 weak_factory_.GetWeakPtr())); | 381 weak_factory_.GetWeakPtr())); |
383 | 382 |
384 // A subsequent registration job may terminate our installing worker. It can | 383 // A subsequent registration job may terminate our installing worker. It can |
385 // only do so after we've started the worker and dispatched the install | 384 // only do so after we've started the worker and dispatched the install |
386 // event, as those are atomic substeps in the [[Install]] algorithm. | 385 // event, as those are atomic substeps in the [[Install]] algorithm. |
387 if (doom_installing_worker_) | 386 if (doom_installing_worker_) |
388 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); | 387 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); |
389 } | 388 } |
390 | 389 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 ServiceWorkerProviderHost* host = it->GetProviderHost(); | 555 ServiceWorkerProviderHost* host = it->GetProviderHost(); |
557 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 556 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
558 host->document_url())) { | 557 host->document_url())) { |
559 if (host->CanAssociateRegistration(registration)) | 558 if (host->CanAssociateRegistration(registration)) |
560 host->AssociateRegistration(registration); | 559 host->AssociateRegistration(registration); |
561 } | 560 } |
562 } | 561 } |
563 } | 562 } |
564 | 563 |
565 } // namespace content | 564 } // namespace content |
OLD | NEW |