Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: Source/modules/fetch/GlobalFetch.cpp

Issue 838003006: Add use counters for Fetch API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/fetch/Body.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/modules/fetch/Body.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698