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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const RegistrationCallback& callback, | 80 const RegistrationCallback& callback, |
81 ServiceWorkerProviderHost* provider_host) { | 81 ServiceWorkerProviderHost* provider_host) { |
82 if (!is_promise_resolved_) { | 82 if (!is_promise_resolved_) { |
83 callbacks_.push_back(callback); | 83 callbacks_.push_back(callback); |
84 if (provider_host) | 84 if (provider_host) |
85 provider_host->AddScopedProcessReferenceToPattern(pattern_); | 85 provider_host->AddScopedProcessReferenceToPattern(pattern_); |
86 return; | 86 return; |
87 } | 87 } |
88 RunSoon(base::Bind(callback, promise_resolved_status_, | 88 RunSoon(base::Bind(callback, promise_resolved_status_, |
89 promise_resolved_status_message_, | 89 promise_resolved_status_message_, |
90 promise_resolved_registration_)); | 90 base::RetainedRef(promise_resolved_registration_))); |
91 } | 91 } |
92 | 92 |
93 void ServiceWorkerRegisterJob::Start() { | 93 void ServiceWorkerRegisterJob::Start() { |
94 BrowserThread::PostAfterStartupTask( | 94 BrowserThread::PostAfterStartupTask( |
95 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), | 95 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), |
96 base::Bind(&ServiceWorkerRegisterJob::StartImpl, | 96 base::Bind(&ServiceWorkerRegisterJob::StartImpl, |
97 weak_factory_.GetWeakPtr())); | 97 weak_factory_.GetWeakPtr())); |
98 } | 98 } |
99 | 99 |
100 void ServiceWorkerRegisterJob::StartImpl() { | 100 void ServiceWorkerRegisterJob::StartImpl() { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); | 592 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); |
593 Complete(SERVICE_WORKER_ERROR_EXISTS, | 593 Complete(SERVICE_WORKER_ERROR_EXISTS, |
594 "The updated worker is identical to the incumbent."); | 594 "The updated worker is identical to the incumbent."); |
595 return; | 595 return; |
596 } | 596 } |
597 | 597 |
598 new_version()->embedded_worker()->ResumeAfterDownload(); | 598 new_version()->embedded_worker()->ResumeAfterDownload(); |
599 } | 599 } |
600 | 600 |
601 } // namespace content | 601 } // namespace content |
OLD | NEW |