| OLD | NEW |
| 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 "modules/fetch/GlobalFetch.h" | 5 #include "modules/fetch/GlobalFetch.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
| 8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
| 9 #include "core/workers/WorkerGlobalScope.h" | 9 #include "core/workers/WorkerGlobalScope.h" |
| 10 #include "modules/fetch/FetchManager.h" | 10 #include "modules/fetch/FetchManager.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 exceptionState.throwTypeError("The global scope is shutting down."); | 37 exceptionState.throwTypeError("The global scope is shutting down."); |
| 38 return ScriptPromise(); | 38 return ScriptPromise(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // "Let |r| be the associated request of the result of invoking the | 41 // "Let |r| be the associated request of the result of invoking the |
| 42 // initial value of Request as constructor with |input| and |init| as | 42 // initial value of Request as constructor with |input| and |init| as |
| 43 // arguments. If this throws an exception, reject |p| with it." | 43 // arguments. If this throws an exception, reject |p| with it." |
| 44 Request* r = Request::create(scriptState, input, init, exceptionState); | 44 Request* r = Request::create(scriptState, input, init, exceptionState); |
| 45 if (exceptionState.hadException()) | 45 if (exceptionState.hadException()) |
| 46 return ScriptPromise(); | 46 return ScriptPromise(); |
| 47 return m_fetchManager->fetch(scriptState, r->passRequestData(scriptState
)); | 47 return m_fetchManager->fetch(scriptState, r->passRequestData()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 DEFINE_INLINE_VIRTUAL_TRACE() | 50 DEFINE_INLINE_VIRTUAL_TRACE() |
| 51 { | 51 { |
| 52 visitor->trace(m_fetchManager); | 52 visitor->trace(m_fetchManager); |
| 53 ScopedFetcher::trace(visitor); | 53 ScopedFetcher::trace(visitor); |
| 54 Supplement<T>::trace(visitor); | 54 Supplement<T>::trace(visitor); |
| 55 } | 55 } |
| 56 | 56 |
| 57 private: | 57 private: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) | 94 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) |
| 95 { | 95 { |
| 96 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. | 96 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. |
| 97 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); | 97 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); |
| 98 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio
nState); | 98 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio
nState); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |