| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return; | 69 return; |
| 70 m_resolver->resolve(ServiceWorkerRegistration::take(m_resolver.get(), re
gistration)); | 70 m_resolver->resolve(ServiceWorkerRegistration::take(m_resolver.get(), re
gistration)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Takes ownership of |errorRaw|. | 73 // Takes ownership of |errorRaw|. |
| 74 void onError(WebServiceWorkerError* errorRaw) override | 74 void onError(WebServiceWorkerError* errorRaw) override |
| 75 { | 75 { |
| 76 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); | 76 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); |
| 77 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) | 77 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) |
| 78 return; | 78 return; |
| 79 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error.rele
ase())); | 79 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), *error)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 83 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 84 WTF_MAKE_NONCOPYABLE(RegistrationCallback); | 84 WTF_MAKE_NONCOPYABLE(RegistrationCallback); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke
rGetRegistrationCallbacks { | 87 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke
rGetRegistrationCallbacks { |
| 88 public: | 88 public: |
| 89 explicit GetRegistrationCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolve
r> resolver) | 89 explicit GetRegistrationCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolve
r> resolver) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 } | 101 } |
| 102 m_resolver->resolve(ServiceWorkerRegistration::take(m_resolver.get(), re
gistration)); | 102 m_resolver->resolve(ServiceWorkerRegistration::take(m_resolver.get(), re
gistration)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Takes ownership of |errorRaw|. | 105 // Takes ownership of |errorRaw|. |
| 106 void onError(WebServiceWorkerError* errorRaw) override | 106 void onError(WebServiceWorkerError* errorRaw) override |
| 107 { | 107 { |
| 108 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); | 108 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); |
| 109 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) | 109 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) |
| 110 return; | 110 return; |
| 111 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error.rele
ase())); | 111 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), *error)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 115 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 116 WTF_MAKE_NONCOPYABLE(GetRegistrationCallback); | 116 WTF_MAKE_NONCOPYABLE(GetRegistrationCallback); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 class GetRegistrationsCallback : public WebServiceWorkerProvider::WebServiceWork
erGetRegistrationsCallbacks { | 119 class GetRegistrationsCallback : public WebServiceWorkerProvider::WebServiceWork
erGetRegistrationsCallbacks { |
| 120 public: | 120 public: |
| 121 explicit GetRegistrationsCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolv
er> resolver) | 121 explicit GetRegistrationsCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolv
er> resolver) |
| 122 : m_resolver(resolver) { } | 122 : m_resolver(resolver) { } |
| 123 ~GetRegistrationsCallback() override { } | 123 ~GetRegistrationsCallback() override { } |
| 124 | 124 |
| 125 // Takes ownership of |registrationsRaw|. | 125 // Takes ownership of |registrationsRaw|. |
| 126 void onSuccess(WebVector<WebServiceWorkerRegistration*>* registrationsRaw) o
verride | 126 void onSuccess(WebVector<WebServiceWorkerRegistration*>* registrationsRaw) o
verride |
| 127 { | 127 { |
| 128 OwnPtr<WebVector<WebServiceWorkerRegistration*>> registrations = adoptPt
r(registrationsRaw); | 128 OwnPtr<WebVector<WebServiceWorkerRegistration*>> registrations = adoptPt
r(registrationsRaw); |
| 129 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) | 129 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) |
| 130 return; | 130 return; |
| 131 m_resolver->resolve(ServiceWorkerRegistrationArray::take(m_resolver.get(
), registrations.release())); | 131 m_resolver->resolve(ServiceWorkerRegistrationArray::take(m_resolver.get(
), registrations.release())); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Takes ownership of |errorRaw|. | 134 // Takes ownership of |errorRaw|. |
| 135 void onError(WebServiceWorkerError* errorRaw) override | 135 void onError(WebServiceWorkerError* errorRaw) override |
| 136 { | 136 { |
| 137 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); | 137 OwnPtr<WebServiceWorkerError> error = adoptPtr(errorRaw); |
| 138 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) | 138 if (!m_resolver->executionContext() || m_resolver->executionContext()->a
ctiveDOMObjectsAreStopped()) |
| 139 return; | 139 return; |
| 140 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error.rele
ase())); | 140 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), *error)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 144 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 145 WTF_MAKE_NONCOPYABLE(GetRegistrationsCallback); | 145 WTF_MAKE_NONCOPYABLE(GetRegistrationsCallback); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class ServiceWorkerContainer::GetRegistrationForReadyCallback : public WebServic
eWorkerProvider::WebServiceWorkerGetRegistrationForReadyCallbacks { | 148 class ServiceWorkerContainer::GetRegistrationForReadyCallback : public WebServic
eWorkerProvider::WebServiceWorkerGetRegistrationForReadyCallbacks { |
| 149 public: | 149 public: |
| 150 explicit GetRegistrationForReadyCallback(ReadyProperty* ready) | 150 explicit GetRegistrationForReadyCallback(ReadyProperty* ready) |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return; | 390 return; |
| 391 | 391 |
| 392 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 392 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
| 393 m_provider = client->provider(); | 393 m_provider = client->provider(); |
| 394 if (m_provider) | 394 if (m_provider) |
| 395 m_provider->setClient(this); | 395 m_provider->setClient(this); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |