Chromium Code Reviews| 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 { | 69 { |
| 70 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) | 70 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) |
| 71 return; | 71 return; |
| 72 m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->g etExecutionContext(), adoptPtr(handle.release()))); | 72 m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->g etExecutionContext(), adoptPtr(handle.release()))); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void onError(const WebServiceWorkerError& error) override | 75 void onError(const WebServiceWorkerError& error) override |
| 76 { | 76 { |
| 77 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) | 77 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) |
| 78 return; | 78 return; |
| 79 ScriptState::Scope scope(m_resolver->getScriptState()); | |
| 79 if (error.errorType == WebServiceWorkerError::ErrorTypeType) { | 80 if (error.errorType == WebServiceWorkerError::ErrorTypeType) { |
| 80 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->get ScriptState()->isolate(), error.message)); | 81 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->get ScriptState()->isolate(), error.message)); |
| 81 } else { | 82 } else { |
| 82 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error) ); | 83 using ServiceWorkerErrorForRegister = ServiceWorkerErrorForUpdate; |
| 84 m_resolver->reject(ServiceWorkerErrorForRegister::take(m_resolver.ge t(), error)); | |
|
falken
2016/07/08 12:39:46
optional nit: mm.. I'd just save a line of code an
e_hakkinen
2016/07/08 12:48:51
Done.
| |
| 83 } | 85 } |
| 84 } | 86 } |
| 85 | 87 |
| 86 private: | 88 private: |
| 87 Persistent<ScriptPromiseResolver> m_resolver; | 89 Persistent<ScriptPromiseResolver> m_resolver; |
| 88 WTF_MAKE_NONCOPYABLE(RegistrationCallback); | 90 WTF_MAKE_NONCOPYABLE(RegistrationCallback); |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks { | 93 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks { |
| 92 public: | 94 public: |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 return; | 419 return; |
| 418 | 420 |
| 419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { | 421 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { |
| 420 m_provider = client->provider(); | 422 m_provider = client->provider(); |
| 421 if (m_provider) | 423 if (m_provider) |
| 422 m_provider->setClient(this); | 424 m_provider->setClient(this); |
| 423 } | 425 } |
| 424 } | 426 } |
| 425 | 427 |
| 426 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |