OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/serviceworkers/ServiceWorkerRegistration.h" | 5 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 9 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 ServiceWorkerRegistration* ServiceWorkerRegistration::GetOrCreate( | 66 ServiceWorkerRegistration* ServiceWorkerRegistration::GetOrCreate( |
67 ExecutionContext* execution_context, | 67 ExecutionContext* execution_context, |
68 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { | 68 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { |
69 DCHECK(handle); | 69 DCHECK(handle); |
70 | 70 |
71 ServiceWorkerRegistration* existing_registration = | 71 ServiceWorkerRegistration* existing_registration = |
72 static_cast<ServiceWorkerRegistration*>(handle->Registration()->Proxy()); | 72 static_cast<ServiceWorkerRegistration*>(handle->Registration()->Proxy()); |
73 if (existing_registration) { | 73 if (existing_registration) { |
74 ASSERT(existing_registration->GetExecutionContext() == execution_context); | 74 DCHECK_EQ(existing_registration->GetExecutionContext(), execution_context); |
75 return existing_registration; | 75 return existing_registration; |
76 } | 76 } |
77 | 77 |
78 return new ServiceWorkerRegistration(execution_context, std::move(handle)); | 78 return new ServiceWorkerRegistration(execution_context, std::move(handle)); |
79 } | 79 } |
80 | 80 |
81 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() { | 81 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() { |
82 if (!navigation_preload_) | 82 if (!navigation_preload_) |
83 navigation_preload_ = NavigationPreloadManager::Create(this); | 83 navigation_preload_ = NavigationPreloadManager::Create(this); |
84 return navigation_preload_; | 84 return navigation_preload_; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 void ServiceWorkerRegistration::ContextDestroyed(ExecutionContext*) { | 162 void ServiceWorkerRegistration::ContextDestroyed(ExecutionContext*) { |
163 if (stopped_) | 163 if (stopped_) |
164 return; | 164 return; |
165 stopped_ = true; | 165 stopped_ = true; |
166 handle_->Registration()->ProxyStopped(); | 166 handle_->Registration()->ProxyStopped(); |
167 } | 167 } |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
OLD | NEW |