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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (!executionContext) | 147 if (!executionContext) |
148 return ScriptPromise(); | 148 return ScriptPromise(); |
149 | 149 |
150 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 150 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
151 ScriptPromise promise = resolver->promise(); | 151 ScriptPromise promise = resolver->promise(); |
152 | 152 |
153 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); | 153 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); |
154 return promise; | 154 return promise; |
155 } | 155 } |
156 | 156 |
157 void ServiceWorkerGlobalScope::setRegistration(WebServiceWorkerRegistration* reg
istration) | 157 void ServiceWorkerGlobalScope::setRegistration(WebServiceWorkerRegistration* reg
istrationRaw) |
158 { | 158 { |
159 if (!executionContext()) { | 159 ASSERT(registrationRaw); |
160 ServiceWorkerRegistration::dispose(registration); | 160 OwnPtr<WebServiceWorkerRegistration> registration = adoptPtr(registrationRaw
); |
| 161 if (!executionContext()) |
161 return; | 162 return; |
162 } | 163 m_registration = ServiceWorkerRegistration::create(executionContext(), regis
tration.release()); |
163 m_registration = ServiceWorkerRegistration::from(executionContext(), registr
ation); | |
164 } | 164 } |
165 | 165 |
166 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtrWillBeRawPtr<EventListener> listener, bool useCapture) | 166 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtrWillBeRawPtr<EventListener> listener, bool useCapture) |
167 { | 167 { |
168 if (m_didEvaluateScript) { | 168 if (m_didEvaluateScript) { |
169 if (eventType == EventTypeNames::install) { | 169 if (eventType == EventTypeNames::install) { |
170 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'install' event m
ust be added on the initial evaluation of worker script."); | 170 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'install' event m
ust be added on the initial evaluation of worker script."); |
171 addMessageToWorkerConsole(consoleMessage.release()); | 171 addMessageToWorkerConsole(consoleMessage.release()); |
172 } else if (eventType == EventTypeNames::activate) { | 172 } else if (eventType == EventTypeNames::activate) { |
173 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'activate' event
must be added on the initial evaluation of worker script."); | 173 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'activate' event
must be added on the initial evaluation of worker script."); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 236 } |
237 | 237 |
238 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) | 238 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) |
239 { | 239 { |
240 ++m_scriptCount; | 240 ++m_scriptCount; |
241 m_scriptTotalSize += scriptSize; | 241 m_scriptTotalSize += scriptSize; |
242 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | 242 m_scriptCachedMetadataTotalSize += cachedMetadataSize; |
243 } | 243 } |
244 | 244 |
245 } // namespace blink | 245 } // namespace blink |
OLD | NEW |