Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerRegistration.cpp

Issue 1177913002: [Retry] ServiceWorker: Implement ServiceWorkerRegistration.update() (1) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove const Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "ServiceWorkerRegistration.h" 6 #include "ServiceWorkerRegistration.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 { 79 {
80 if (registration && !registration->proxy()) 80 if (registration && !registration->proxy())
81 delete registration; 81 delete registration;
82 } 82 }
83 83
84 String ServiceWorkerRegistration::scope() const 84 String ServiceWorkerRegistration::scope() const
85 { 85 {
86 return m_outerRegistration->scope().string(); 86 return m_outerRegistration->scope().string();
87 } 87 }
88 88
89 void ServiceWorkerRegistration::update(ScriptState* scriptState, ExceptionState& exceptionState)
90 {
91 if (!m_provider) {
92 exceptionState.throwDOMException(InvalidStateError, "Failed to update a ServiceWorkerRegistration: No associated provider is available.");
93 return;
94 }
95 m_outerRegistration->update(m_provider);
96 }
97
89 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) 98 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState)
90 { 99 {
91 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 100 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
92 ScriptPromise promise = resolver->promise(); 101 ScriptPromise promise = resolver->promise();
93 102
94 if (!m_provider) { 103 if (!m_provider) {
95 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre gister a ServiceWorkerRegistration: No associated provider is available.")); 104 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre gister a ServiceWorkerRegistration: No associated provider is available."));
96 return promise; 105 return promise;
97 } 106 }
98 107
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 170
162 void ServiceWorkerRegistration::stop() 171 void ServiceWorkerRegistration::stop()
163 { 172 {
164 if (m_stopped) 173 if (m_stopped)
165 return; 174 return;
166 m_stopped = true; 175 m_stopped = true;
167 m_outerRegistration->proxyStopped(); 176 m_outerRegistration->proxyStopped();
168 } 177 }
169 178
170 } // namespace blink 179 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerRegistration.h ('k') | Source/modules/serviceworkers/ServiceWorkerRegistration.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698