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

Side by Side Diff: Source/core/inspector/InspectorResourceAgent.h

Issue 1259393002: DevTools: add support for logging fetch requests when XHR logging is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef InspectorResourceAgent_h 31 #ifndef InspectorResourceAgent_h
32 #define InspectorResourceAgent_h 32 #define InspectorResourceAgent_h
33 33
34 #include "bindings/core/v8/ScriptString.h" 34 #include "bindings/core/v8/ScriptString.h"
35 #include "core/CoreExport.h" 35 #include "core/CoreExport.h"
36 #include "core/InspectorFrontend.h" 36 #include "core/InspectorFrontend.h"
37 #include "core/inspector/InspectorBaseAgent.h" 37 #include "core/inspector/InspectorBaseAgent.h"
38 #include "core/inspector/InspectorPageAgent.h"
38 #include "platform/Timer.h" 39 #include "platform/Timer.h"
39 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
40 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
41 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class Resource; 46 class Resource;
46 struct FetchInitiatorInfo; 47 struct FetchInitiatorInfo;
47 class Document; 48 class Document;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void didCommitLoad(LocalFrame*, DocumentLoader*); 93 void didCommitLoad(LocalFrame*, DocumentLoader*);
93 void scriptImported(unsigned long identifier, const String& sourceString); 94 void scriptImported(unsigned long identifier, const String& sourceString);
94 void didReceiveScriptResponse(unsigned long identifier); 95 void didReceiveScriptResponse(unsigned long identifier);
95 bool shouldForceCORSPreflight(); 96 bool shouldForceCORSPreflight();
96 97
97 void documentThreadableLoaderStartedLoadingForClient(unsigned long identifie r, ThreadableLoaderClient*); 98 void documentThreadableLoaderStartedLoadingForClient(unsigned long identifie r, ThreadableLoaderClient*);
98 void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicStrin g& method, const KURL&, bool async, PassRefPtr<FormData> body, const HTTPHeaderM ap& headers, bool includeCrendentials); 99 void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicStrin g& method, const KURL&, bool async, PassRefPtr<FormData> body, const HTTPHeaderM ap& headers, bool includeCrendentials);
99 void didFailXHRLoading(ExecutionContext*, XMLHttpRequest*, ThreadableLoaderC lient*, const AtomicString&, const String&); 100 void didFailXHRLoading(ExecutionContext*, XMLHttpRequest*, ThreadableLoaderC lient*, const AtomicString&, const String&);
100 void didFinishXHRLoading(ExecutionContext*, XMLHttpRequest*, ThreadableLoade rClient*, const AtomicString&, const String&); 101 void didFinishXHRLoading(ExecutionContext*, XMLHttpRequest*, ThreadableLoade rClient*, const AtomicString&, const String&);
101 102
103 void willStartFetch(ThreadableLoaderClient*);
104 void didFailFetch(ThreadableLoaderClient*);
105 void didFinishFetch(ExecutionContext*, ThreadableLoaderClient*, const Atomic String& method, const String& url);
106
102 void willSendEventSourceRequest(ThreadableLoaderClient*); 107 void willSendEventSourceRequest(ThreadableLoaderClient*);
103 void willDispachEventSourceEvent(ThreadableLoaderClient*, const AtomicString & eventName, const AtomicString& eventId, const Vector<UChar>& data); 108 void willDispachEventSourceEvent(ThreadableLoaderClient*, const AtomicString & eventName, const AtomicString& eventId, const Vector<UChar>& data);
104 void didFinishEventSourceRequest(ThreadableLoaderClient*); 109 void didFinishEventSourceRequest(ThreadableLoaderClient*);
105 110
106 void willDestroyResource(Resource*); 111 void willDestroyResource(Resource*);
107 112
108 void applyUserAgentOverride(String* userAgent); 113 void applyUserAgentOverride(String* userAgent);
109 114
110 // FIXME: InspectorResourceAgent should not be aware of style recalculation. 115 // FIXME: InspectorResourceAgent should not be aware of style recalculation.
111 void willRecalculateStyle(Document*); 116 void willRecalculateStyle(Document*);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void setHostId(const String&); 150 void setHostId(const String&);
146 bool fetchResourceContent(Document*, const KURL&, String* content, bool* bas e64Encoded); 151 bool fetchResourceContent(Document*, const KURL&, String* content, bool* bas e64Encoded);
147 152
148 private: 153 private:
149 explicit InspectorResourceAgent(InspectorPageAgent*); 154 explicit InspectorResourceAgent(InspectorPageAgent*);
150 155
151 void enable(); 156 void enable();
152 void delayedRemoveReplayXHR(XMLHttpRequest*); 157 void delayedRemoveReplayXHR(XMLHttpRequest*);
153 void removeFinishedReplayXHRFired(Timer<InspectorResourceAgent>*); 158 void removeFinishedReplayXHRFired(Timer<InspectorResourceAgent>*);
154 void didFinishXHRInternal(ExecutionContext*, XMLHttpRequest*, ThreadableLoad erClient*, const AtomicString&, const String&, bool); 159 void didFinishXHRInternal(ExecutionContext*, XMLHttpRequest*, ThreadableLoad erClient*, const AtomicString&, const String&, bool);
160 void completeFetch(ThreadableLoaderClient*);
155 161
156 bool getResponseBodyBlob(const String& requestId, PassRefPtrWillBeRawPtr<Get ResponseBodyCallback>); 162 bool getResponseBodyBlob(const String& requestId, PassRefPtrWillBeRawPtr<Get ResponseBodyCallback>);
157 163
158 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; 164 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent;
159 String m_userAgentOverride; 165 String m_userAgentOverride;
160 String m_hostId; 166 String m_hostId;
161 OwnPtr<NetworkResourcesData> m_resourcesData; 167 OwnPtr<NetworkResourcesData> m_resourcesData;
162 168
163 typedef HashMap<ThreadableLoaderClient*, unsigned long> ThreadableLoaderClie ntRequestIdMap; 169 typedef HashMap<ThreadableLoaderClient*, unsigned long> ThreadableLoaderClie ntRequestIdMap;
164 170
165 // Stores the data for replaying XHR until an identifier for the load is 171 // Stores the pending ThreadableLoaderClient till an identifier for
166 // generated by the loader and passed to the inspector via the 172 // the load is generated by the loader and passed to the inspector
167 // documentThreadableLoaderStartedLoadingForClient() method. 173 // via the documentThreadableLoaderStartedLoadingForClient() method.
168 ThreadableLoaderClient* m_pendingXHR; 174 ThreadableLoaderClient* m_pendingRequest;
175 InspectorPageAgent::ResourceType m_pendingRequestType;
176 ThreadableLoaderClientRequestIdMap m_knownRequestIdMap;
177
169 RefPtrWillBeMember<XHRReplayData> m_pendingXHRReplayData; 178 RefPtrWillBeMember<XHRReplayData> m_pendingXHRReplayData;
170 ThreadableLoaderClientRequestIdMap m_xhrRequestIdMap;
171
172 // Stores the pointer to the ThreadableLoaderClient for an EventSource
173 // (actually, the EventSource instance itself) for which a loader is being
174 // initialized, until an identifier for the load is generated by the loader
175 // and passed to the inspector via the
176 // documentThreadableLoaderStartedLoadingForClient() method.
177 //
178 // Since the DocumentThreadableLoader may call
179 // documentThreadableLoaderStartedLoadingForClient() only synchronously to
180 // the creation of the loader, it's unnecessary to store the pointer to a
181 // map.
182 ThreadableLoaderClient* m_pendingEventSource;
183 ThreadableLoaderClientRequestIdMap m_eventSourceRequestIdMap;
184 179
185 typedef HashMap<String, RefPtr<TypeBuilder::Network::Initiator> > FrameNavig ationInitiatorMap; 180 typedef HashMap<String, RefPtr<TypeBuilder::Network::Initiator> > FrameNavig ationInitiatorMap;
186 FrameNavigationInitiatorMap m_frameNavigationInitiatorMap; 181 FrameNavigationInitiatorMap m_frameNavigationInitiatorMap;
187 182
188 // FIXME: InspectorResourceAgent should now be aware of style recalculation. 183 // FIXME: InspectorResourceAgent should now be aware of style recalculation.
189 RefPtr<TypeBuilder::Network::Initiator> m_styleRecalculationInitiator; 184 RefPtr<TypeBuilder::Network::Initiator> m_styleRecalculationInitiator;
190 bool m_isRecalculatingStyle; 185 bool m_isRecalculatingStyle;
191 186
192 PersistentHeapHashSetWillBeHeapHashSet<Member<XMLHttpRequest>> m_replayXHRs; 187 PersistentHeapHashSetWillBeHeapHashSet<Member<XMLHttpRequest>> m_replayXHRs;
193 PersistentHeapHashSetWillBeHeapHashSet<Member<XMLHttpRequest>> m_replayXHRsT oBeDeleted; 188 PersistentHeapHashSetWillBeHeapHashSet<Member<XMLHttpRequest>> m_replayXHRsT oBeDeleted;
194 Timer<InspectorResourceAgent> m_removeFinishedReplayXHRTimer; 189 Timer<InspectorResourceAgent> m_removeFinishedReplayXHRTimer;
195 }; 190 };
196 191
197 } // namespace blink 192 } // namespace blink
198 193
199 194
200 #endif // !defined(InspectorResourceAgent_h) 195 #endif // !defined(InspectorResourceAgent_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698