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

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

Issue 669423002: Only dispose proxy-less WebServiceWorkerRegistration objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return getOrCreate(executionContext, registration); 83 return getOrCreate(executionContext, registration);
84 } 84 }
85 85
86 ServiceWorkerRegistration* ServiceWorkerRegistration::take(ScriptPromiseResolver * resolver, WebType* registration) 86 ServiceWorkerRegistration* ServiceWorkerRegistration::take(ScriptPromiseResolver * resolver, WebType* registration)
87 { 87 {
88 return from(resolver->scriptState()->executionContext(), registration); 88 return from(resolver->scriptState()->executionContext(), registration);
89 } 89 }
90 90
91 void ServiceWorkerRegistration::dispose(WebType* registration) 91 void ServiceWorkerRegistration::dispose(WebType* registration)
92 { 92 {
93 delete registration; 93 if (registration && !registration->proxy())
94 delete registration;
94 } 95 }
95 96
96 String ServiceWorkerRegistration::scope() const 97 String ServiceWorkerRegistration::scope() const
97 { 98 {
98 return m_outerRegistration->scope().string(); 99 return m_outerRegistration->scope().string();
99 } 100 }
100 101
101 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) 102 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState)
102 { 103 {
103 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 104 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 void ServiceWorkerRegistration::stop() 173 void ServiceWorkerRegistration::stop()
173 { 174 {
174 if (m_stopped) 175 if (m_stopped)
175 return; 176 return;
176 m_stopped = true; 177 m_stopped = true;
177 m_outerRegistration->proxyStopped(); 178 m_outerRegistration->proxyStopped();
178 } 179 }
179 180
180 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698