Chromium Code Reviews| 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/inspector/InspectorInstrumentation.h" | |
| 9 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| 10 #include "modules/fetch/FetchManager.h" | 11 #include "modules/fetch/FetchManager.h" |
| 11 #include "modules/fetch/Request.h" | 12 #include "modules/fetch/Request.h" |
| 12 #include "platform/Supplementable.h" | 13 #include "platform/Supplementable.h" |
| 13 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 14 #include "wtf/OwnPtr.h" | 15 #include "wtf/OwnPtr.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 42 exceptionState.throwTypeError("The global scope is shutting down."); | 43 exceptionState.throwTypeError("The global scope is shutting down."); |
| 43 return ScriptPromise(); | 44 return ScriptPromise(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 // "Let |r| be the associated request of the result of invoking the | 47 // "Let |r| be the associated request of the result of invoking the |
| 47 // initial value of Request as constructor with |input| and |init| as | 48 // initial value of Request as constructor with |input| and |init| as |
| 48 // arguments. If this throws an exception, reject |p| with it." | 49 // arguments. If this throws an exception, reject |p| with it." |
| 49 Request* r = Request::create(scriptState, input, init, exceptionState); | 50 Request* r = Request::create(scriptState, input, init, exceptionState); |
| 50 if (exceptionState.hadException()) | 51 if (exceptionState.hadException()) |
| 51 return ScriptPromise(); | 52 return ScriptPromise(); |
| 53 | |
| 54 if (ExecutionContext* executionContext = m_fetchManager->getExecutionCon text()) | |
| 55 InspectorInstrumentation::willSendXMLHttpRequest(executionContext, r ->url()); | |
|
dgozman
2016/05/25 22:00:32
Let's rename this to |willIssueNetworkRequest|.
kozy
2016/05/25 22:24:31
Done.
| |
| 52 return m_fetchManager->fetch(scriptState, r->passRequestData(scriptState )); | 56 return m_fetchManager->fetch(scriptState, r->passRequestData(scriptState )); |
| 53 } | 57 } |
| 54 | 58 |
| 55 DEFINE_INLINE_VIRTUAL_TRACE() | 59 DEFINE_INLINE_VIRTUAL_TRACE() |
| 56 { | 60 { |
| 57 visitor->trace(m_fetchManager); | 61 visitor->trace(m_fetchManager); |
| 58 ScopedFetcher::trace(visitor); | 62 ScopedFetcher::trace(visitor); |
| 59 Supplement<T>::trace(visitor); | 63 Supplement<T>::trace(visitor); |
| 60 } | 64 } |
| 61 | 65 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 } | 101 } |
| 98 | 102 |
| 99 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio nState) | 103 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio nState) |
| 100 { | 104 { |
| 101 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. | 105 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. |
| 102 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); | 106 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); |
| 103 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio nState); | 107 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio nState); |
| 104 } | 108 } |
| 105 | 109 |
| 106 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |