| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 namespace blink { | 54 namespace blink { |
| 55 | 55 |
| 56 // This wraps CallbackPromiseAdapter and resolves the promise with undefined | 56 // This wraps CallbackPromiseAdapter and resolves the promise with undefined |
| 57 // when nullptr is given to onSuccess. | 57 // when nullptr is given to onSuccess. |
| 58 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke
rGetRegistrationCallbacks { | 58 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke
rGetRegistrationCallbacks { |
| 59 public: | 59 public: |
| 60 explicit GetRegistrationCallback(PassRefPtr<ScriptPromiseResolver> resolver) | 60 explicit GetRegistrationCallback(PassRefPtr<ScriptPromiseResolver> resolver) |
| 61 : m_resolver(resolver) | 61 : m_resolver(resolver) |
| 62 , m_adapter(m_resolver) { } | 62 , m_adapter(m_resolver) { } |
| 63 virtual ~GetRegistrationCallback() { } | 63 virtual ~GetRegistrationCallback() { } |
| 64 virtual void onSuccess(WebServiceWorkerRegistration* registration) OVERRIDE | 64 virtual void onSuccess(WebServiceWorkerRegistration* registration) override |
| 65 { | 65 { |
| 66 if (registration) | 66 if (registration) |
| 67 m_adapter.onSuccess(registration); | 67 m_adapter.onSuccess(registration); |
| 68 else if (m_resolver->executionContext() && !m_resolver->executionContext
()->activeDOMObjectsAreStopped()) | 68 else if (m_resolver->executionContext() && !m_resolver->executionContext
()->activeDOMObjectsAreStopped()) |
| 69 m_resolver->resolve(); | 69 m_resolver->resolve(); |
| 70 } | 70 } |
| 71 virtual void onError(WebServiceWorkerError* error) OVERRIDE { m_adapter.onEr
ror(error); } | 71 virtual void onError(WebServiceWorkerError* error) override { m_adapter.onEr
ror(error); } |
| 72 private: | 72 private: |
| 73 RefPtr<ScriptPromiseResolver> m_resolver; | 73 RefPtr<ScriptPromiseResolver> m_resolver; |
| 74 CallbackPromiseAdapter<ServiceWorkerRegistration, ServiceWorkerError> m_adap
ter; | 74 CallbackPromiseAdapter<ServiceWorkerRegistration, ServiceWorkerError> m_adap
ter; |
| 75 WTF_MAKE_NONCOPYABLE(GetRegistrationCallback); | 75 WTF_MAKE_NONCOPYABLE(GetRegistrationCallback); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 ServiceWorkerContainer* ServiceWorkerContainer::create(ExecutionContext* executi
onContext) | 78 ServiceWorkerContainer* ServiceWorkerContainer::create(ExecutionContext* executi
onContext) |
| 79 { | 79 { |
| 80 return new ServiceWorkerContainer(executionContext); | 80 return new ServiceWorkerContainer(executionContext); |
| 81 } | 81 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 m_ready = createReadyProperty(); | 263 m_ready = createReadyProperty(); |
| 264 | 264 |
| 265 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 265 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
| 266 m_provider = client->provider(); | 266 m_provider = client->provider(); |
| 267 if (m_provider) | 267 if (m_provider) |
| 268 m_provider->setClient(this); | 268 m_provider->setClient(this); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace blink | 272 } // namespace blink |
| OLD | NEW |