| 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/push_messaging/PushSubscriptionCallbacks.h" | 5 #include "modules/push_messaging/PushSubscriptionCallbacks.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "modules/push_messaging/PushError.h" | 8 #include "modules/push_messaging/PushError.h" |
| 9 #include "modules/push_messaging/PushSubscription.h" | 9 #include "modules/push_messaging/PushSubscription.h" |
| 10 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 10 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
| 11 #include "platform/wtf/Assertions.h" |
| 12 #include "platform/wtf/PtrUtil.h" |
| 11 #include "public/platform/modules/push_messaging/WebPushSubscription.h" | 13 #include "public/platform/modules/push_messaging/WebPushSubscription.h" |
| 12 #include "wtf/Assertions.h" | |
| 13 #include "wtf/PtrUtil.h" | |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 PushSubscriptionCallbacks::PushSubscriptionCallbacks( | 17 PushSubscriptionCallbacks::PushSubscriptionCallbacks( |
| 18 ScriptPromiseResolver* resolver, | 18 ScriptPromiseResolver* resolver, |
| 19 ServiceWorkerRegistration* service_worker_registration) | 19 ServiceWorkerRegistration* service_worker_registration) |
| 20 : resolver_(resolver), | 20 : resolver_(resolver), |
| 21 service_worker_registration_(service_worker_registration) { | 21 service_worker_registration_(service_worker_registration) { |
| 22 DCHECK(resolver_); | 22 DCHECK(resolver_); |
| 23 DCHECK(service_worker_registration_); | 23 DCHECK(service_worker_registration_); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 void PushSubscriptionCallbacks::OnError(const WebPushError& error) { | 39 void PushSubscriptionCallbacks::OnError(const WebPushError& error) { |
| 40 if (!resolver_->GetExecutionContext() || | 40 if (!resolver_->GetExecutionContext() || |
| 41 resolver_->GetExecutionContext()->IsContextDestroyed()) | 41 resolver_->GetExecutionContext()->IsContextDestroyed()) |
| 42 return; | 42 return; |
| 43 resolver_->Reject(PushError::Take(resolver_.Get(), error)); | 43 resolver_->Reject(PushError::Take(resolver_.Get(), error)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace blink | 46 } // namespace blink |
| OLD | NEW |