| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "platform/weborigin/KURL.h" | 53 #include "platform/weborigin/KURL.h" |
| 54 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" | 54 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" |
| 55 #include "public/platform/WebURL.h" | 55 #include "public/platform/WebURL.h" |
| 56 #include "wtf/CurrentTime.h" | 56 #include "wtf/CurrentTime.h" |
| 57 | 57 |
| 58 namespace blink { | 58 namespace blink { |
| 59 | 59 |
| 60 class ServiceWorkerGlobalScope::SkipWaitingCallback final : public WebServiceWor
kerSkipWaitingCallbacks { | 60 class ServiceWorkerGlobalScope::SkipWaitingCallback final : public WebServiceWor
kerSkipWaitingCallbacks { |
| 61 WTF_MAKE_NONCOPYABLE(SkipWaitingCallback); | 61 WTF_MAKE_NONCOPYABLE(SkipWaitingCallback); |
| 62 public: | 62 public: |
| 63 explicit SkipWaitingCallback(PassRefPtr<ScriptPromiseResolver> resolver) | 63 explicit SkipWaitingCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> r
esolver) |
| 64 : m_resolver(resolver) { } | 64 : m_resolver(resolver) { } |
| 65 ~SkipWaitingCallback() { } | 65 ~SkipWaitingCallback() { } |
| 66 | 66 |
| 67 void onSuccess() override | 67 void onSuccess() override |
| 68 { | 68 { |
| 69 m_resolver->resolve(); | 69 m_resolver->resolve(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 RefPtr<ScriptPromiseResolver> m_resolver; | 73 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> s
tartupData) | 76 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> s
tartupData) |
| 77 { | 77 { |
| 78 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeNoop(ne
w ServiceWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, t
hread, monotonicallyIncreasingTime(), startupData->m_starterOrigin, startupData-
>m_workerClients.release())); | 78 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeNoop(ne
w ServiceWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, t
hread, monotonicallyIncreasingTime(), startupData->m_starterOrigin, startupData-
>m_workerClients.release())); |
| 79 | 79 |
| 80 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); | 80 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); |
| 81 | 81 |
| 82 return context.release(); | 82 return context.release(); |
| 83 } | 83 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return m_clients; | 124 return m_clients; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState) | 127 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState) |
| 128 { | 128 { |
| 129 exceptionState.throwDOMException(InvalidAccessError, "Not supported."); | 129 exceptionState.throwDOMException(InvalidAccessError, "Not supported."); |
| 130 } | 130 } |
| 131 | 131 |
| 132 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState) | 132 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState) |
| 133 { | 133 { |
| 134 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip
tState); | 134 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 135 ScriptPromise promise = resolver->promise(); | 135 ScriptPromise promise = resolver->promise(); |
| 136 | 136 |
| 137 ExecutionContext* executionContext = scriptState->executionContext(); | 137 ExecutionContext* executionContext = scriptState->executionContext(); |
| 138 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); | 138 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); |
| 139 return promise; | 139 return promise; |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtr<EventListener> listener, bool useCapture) | 142 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtr<EventListener> listener, bool useCapture) |
| 143 { | 143 { |
| 144 if (m_didEvaluateScript) { | 144 if (m_didEvaluateScript) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) | 198 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) |
| 199 { | 199 { |
| 200 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); | 200 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); |
| 201 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | 201 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); |
| 202 consoleMessage->setScriptId(scriptId); | 202 consoleMessage->setScriptId(scriptId); |
| 203 consoleMessage->setCallStack(callStack); | 203 consoleMessage->setCallStack(callStack); |
| 204 addMessageToWorkerConsole(consoleMessage.release()); | 204 addMessageToWorkerConsole(consoleMessage.release()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |