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 "config.h" | 5 #include "config.h" |
6 #include "modules/fetch/GlobalFetch.h" | 6 #include "modules/fetch/GlobalFetch.h" |
7 | 7 |
8 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/frame/UseCounter.h" |
10 #include "core/workers/WorkerGlobalScope.h" | 11 #include "core/workers/WorkerGlobalScope.h" |
11 #include "modules/fetch/FetchManager.h" | 12 #include "modules/fetch/FetchManager.h" |
12 #include "modules/fetch/Request.h" | 13 #include "modules/fetch/Request.h" |
13 #include "platform/Supplementable.h" | 14 #include "platform/Supplementable.h" |
14 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
15 #include "wtf/OwnPtr.h" | 16 #include "wtf/OwnPtr.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 namespace { | 20 namespace { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 static const char* name() { return "GlobalFetch"; } | 94 static const char* name() { return "GlobalFetch"; } |
94 | 95 |
95 OwnPtrWillBeMember<FetchManager> m_fetchManager; | 96 OwnPtrWillBeMember<FetchManager> m_fetchManager; |
96 OwnPtrWillBeMember<StopDetector> m_stopDetector; | 97 OwnPtrWillBeMember<StopDetector> m_stopDetector; |
97 }; | 98 }; |
98 | 99 |
99 } // namespace | 100 } // namespace |
100 | 101 |
101 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, DOMWindow& window, co
nst RequestInfo& input, const Dictionary& init, ExceptionState& exceptionState) | 102 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, DOMWindow& window, co
nst RequestInfo& input, const Dictionary& init, ExceptionState& exceptionState) |
102 { | 103 { |
| 104 UseCounter::count(window.executionContext(), UseCounter::Fetch); |
103 return GlobalFetchImpl<LocalDOMWindow>::from(toLocalDOMWindow(window), windo
w.executionContext()).fetch(scriptState, input, init, exceptionState); | 105 return GlobalFetchImpl<LocalDOMWindow>::from(toLocalDOMWindow(window), windo
w.executionContext()).fetch(scriptState, input, init, exceptionState); |
104 } | 106 } |
105 | 107 |
106 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) | 108 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) |
107 { | 109 { |
| 110 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. |
| 111 UseCounter::count(worker.executionContext(), UseCounter::Fetch); |
108 return GlobalFetchImpl<WorkerGlobalScope>::from(worker, worker.executionCont
ext()).fetch(scriptState, input, init, exceptionState); | 112 return GlobalFetchImpl<WorkerGlobalScope>::from(worker, worker.executionCont
ext()).fetch(scriptState, input, init, exceptionState); |
109 } | 113 } |
110 | 114 |
111 } // namespace blink | 115 } // namespace blink |
OLD | NEW |