| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (!executionContext) | 134 if (!executionContext) |
| 135 return ScriptPromise(); | 135 return ScriptPromise(); |
| 136 | 136 |
| 137 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 137 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 138 ScriptPromise promise = resolver->promise(); | 138 ScriptPromise promise = resolver->promise(); |
| 139 | 139 |
| 140 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Call
backPromiseAdapter<void, void>(resolver)); | 140 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Call
backPromiseAdapter<void, void>(resolver)); |
| 141 return promise; | 141 return promise; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ServiceWorkerGlobalScope::setRegistration(WebPassOwnPtr<WebServiceWorkerReg
istration::Handle> handle) | 144 void ServiceWorkerGlobalScope::setRegistration(std::unique_ptr<WebServiceWorkerR
egistration::Handle> handle) |
| 145 { | 145 { |
| 146 if (!getExecutionContext()) | 146 if (!getExecutionContext()) |
| 147 return; | 147 return; |
| 148 m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(
), handle.release()); | 148 m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(
), adoptPtr(handle.release())); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& even
tType, EventListener* listener, const EventListenerOptions& options) | 151 bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& even
tType, EventListener* listener, const EventListenerOptions& options) |
| 152 { | 152 { |
| 153 if (m_didEvaluateScript) { | 153 if (m_didEvaluateScript) { |
| 154 if (eventType == EventTypeNames::install) { | 154 if (eventType == EventTypeNames::install) { |
| 155 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMes
sageSource, WarningMessageLevel, "Event handler of 'install' event must be added
on the initial evaluation of worker script."); | 155 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMes
sageSource, WarningMessageLevel, "Event handler of 'install' event must be added
on the initial evaluation of worker script."); |
| 156 addMessageToWorkerConsole(consoleMessage.release()); | 156 addMessageToWorkerConsole(consoleMessage.release()); |
| 157 } else if (eventType == EventTypeNames::activate) { | 157 } else if (eventType == EventTypeNames::activate) { |
| 158 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMes
sageSource, WarningMessageLevel, "Event handler of 'activate' event must be adde
d on the initial evaluation of worker script."); | 158 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMes
sageSource, WarningMessageLevel, "Event handler of 'activate' event must be adde
d on the initial evaluation of worker script."); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) | 223 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) |
| 224 { | 224 { |
| 225 ++m_scriptCount; | 225 ++m_scriptCount; |
| 226 m_scriptTotalSize += scriptSize; | 226 m_scriptTotalSize += scriptSize; |
| 227 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | 227 m_scriptCachedMetadataTotalSize += cachedMetadataSize; |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |