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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h

Issue 2900613002: Support DevTools for off-main-thread-fetch (Closed)
Patch Set: rebase Created 3 years, 5 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class HTTPHeaderMap; 50 class HTTPHeaderMap;
51 class InspectedFrames; 51 class InspectedFrames;
52 class KURL; 52 class KURL;
53 class NetworkResourcesData; 53 class NetworkResourcesData;
54 class Resource; 54 class Resource;
55 class ResourceError; 55 class ResourceError;
56 class ResourceResponse; 56 class ResourceResponse;
57 class ThreadableLoaderClient; 57 class ThreadableLoaderClient;
58 class XHRReplayData; 58 class XHRReplayData;
59 class XMLHttpRequest; 59 class XMLHttpRequest;
60
61 class WebSocketHandshakeRequest; 60 class WebSocketHandshakeRequest;
62 class WebSocketHandshakeResponse; 61 class WebSocketHandshakeResponse;
62 class WorkerGlobalScope;
63 63
64 class CORE_EXPORT InspectorNetworkAgent final 64 class CORE_EXPORT InspectorNetworkAgent final
65 : public InspectorBaseAgent<protocol::Network::Metainfo> { 65 : public InspectorBaseAgent<protocol::Network::Metainfo> {
66 public: 66 public:
67 static InspectorNetworkAgent* Create(InspectedFrames* inspected_frames) { 67 static InspectorNetworkAgent* Create(InspectedFrames* inspected_frames) {
68 return new InspectorNetworkAgent(inspected_frames); 68 return new InspectorNetworkAgent(inspected_frames, nullptr);
69 }
70 static InspectorNetworkAgent* CreateForWorker(
71 WorkerGlobalScope* worker_global_scope) {
72 // TODO(horo): Extract the logc for frames and for workers into different
73 // classes.
74 return new InspectorNetworkAgent(nullptr, worker_global_scope);
69 } 75 }
70 76
71 void Restore() override; 77 void Restore() override;
72 78
73 ~InspectorNetworkAgent() override; 79 ~InspectorNetworkAgent() override;
74 DECLARE_VIRTUAL_TRACE(); 80 DECLARE_VIRTUAL_TRACE();
75 81
76 // Probes. 82 // Probes.
77 void DidBlockRequest(LocalFrame*, 83 void DidBlockRequest(ExecutionContext*,
78 const ResourceRequest&, 84 const ResourceRequest&,
79 DocumentLoader*, 85 DocumentLoader*,
80 const FetchInitiatorInfo&, 86 const FetchInitiatorInfo&,
81 ResourceRequestBlockedReason); 87 ResourceRequestBlockedReason);
82 void DidChangeResourcePriority(unsigned long identifier, 88 void DidChangeResourcePriority(unsigned long identifier,
83 ResourceLoadPriority); 89 ResourceLoadPriority);
84 void WillSendRequest(LocalFrame*, 90 void WillSendRequest(ExecutionContext*,
85 unsigned long identifier, 91 unsigned long identifier,
86 DocumentLoader*, 92 DocumentLoader*,
87 ResourceRequest&, 93 ResourceRequest&,
88 const ResourceResponse& redirect_response, 94 const ResourceResponse& redirect_response,
89 const FetchInitiatorInfo&); 95 const FetchInitiatorInfo&);
90 void MarkResourceAsCached(unsigned long identifier); 96 void MarkResourceAsCached(unsigned long identifier);
91 void DidReceiveResourceResponse(LocalFrame*, 97 void DidReceiveResourceResponse(unsigned long identifier,
92 unsigned long identifier,
93 DocumentLoader*, 98 DocumentLoader*,
94 const ResourceResponse&, 99 const ResourceResponse&,
95 Resource*); 100 Resource*);
96 void DidReceiveData(LocalFrame*, 101 void DidReceiveData(unsigned long identifier,
97 unsigned long identifier, 102 DocumentLoader*,
98 const char* data, 103 const char* data,
99 int data_length); 104 int data_length);
100 void DidReceiveEncodedDataLength(LocalFrame*, 105 void DidReceiveEncodedDataLength(unsigned long identifier,
101 unsigned long identifier,
102 int encoded_data_length); 106 int encoded_data_length);
103 void DidFinishLoading(LocalFrame*, 107 void DidFinishLoading(unsigned long identifier,
104 unsigned long identifier, 108 DocumentLoader*,
105 double monotonic_finish_time, 109 double monotonic_finish_time,
106 int64_t encoded_data_length, 110 int64_t encoded_data_length,
107 int64_t decoded_body_length); 111 int64_t decoded_body_length);
108 void DidReceiveCORSRedirectResponse(LocalFrame*, 112 void DidReceiveCORSRedirectResponse(LocalFrame*,
109 unsigned long identifier, 113 unsigned long identifier,
110 DocumentLoader*, 114 DocumentLoader*,
111 const ResourceResponse&, 115 const ResourceResponse&,
112 Resource*); 116 Resource*);
113 void DidFailLoading(unsigned long identifier, const ResourceError&); 117 void DidFailLoading(unsigned long identifier, const ResourceError&);
114 void DidCommitLoad(LocalFrame*, DocumentLoader*); 118 void DidCommitLoad(LocalFrame*, DocumentLoader*);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 227
224 // Called from other agents. 228 // Called from other agents.
225 void SetHostId(const String&); 229 void SetHostId(const String&);
226 bool FetchResourceContent(Document*, 230 bool FetchResourceContent(Document*,
227 const KURL&, 231 const KURL&,
228 String* content, 232 String* content,
229 bool* base64_encoded); 233 bool* base64_encoded);
230 bool CacheDisabled(); 234 bool CacheDisabled();
231 235
232 private: 236 private:
233 explicit InspectorNetworkAgent(InspectedFrames*); 237 explicit InspectorNetworkAgent(InspectedFrames*, WorkerGlobalScope*);
234 238
235 void Enable(int total_buffer_size, int resource_buffer_size); 239 void Enable(int total_buffer_size, int resource_buffer_size);
236 void WillSendRequestInternal(LocalFrame*, 240 void WillSendRequestInternal(ExecutionContext*,
237 unsigned long identifier, 241 unsigned long identifier,
238 DocumentLoader*, 242 DocumentLoader*,
239 const ResourceRequest&, 243 const ResourceRequest&,
240 const ResourceResponse& redirect_response, 244 const ResourceResponse& redirect_response,
241 const FetchInitiatorInfo&); 245 const FetchInitiatorInfo&);
242 void DelayedRemoveReplayXHR(XMLHttpRequest*); 246 void DelayedRemoveReplayXHR(XMLHttpRequest*);
243 void RemoveFinishedReplayXHRFired(TimerBase*); 247 void RemoveFinishedReplayXHRFired(TimerBase*);
244 void DidFinishXHRInternal(ExecutionContext*, 248 void DidFinishXHRInternal(ExecutionContext*,
245 XMLHttpRequest*, 249 XMLHttpRequest*,
246 ThreadableLoaderClient*, 250 ThreadableLoaderClient*,
247 const AtomicString&, 251 const AtomicString&,
248 const String&, 252 const String&,
249 bool); 253 bool);
250 254
251 bool CanGetResponseBodyBlob(const String& request_id); 255 bool CanGetResponseBodyBlob(const String& request_id);
252 void GetResponseBodyBlob(const String& request_id, 256 void GetResponseBodyBlob(const String& request_id,
253 std::unique_ptr<GetResponseBodyCallback>); 257 std::unique_ptr<GetResponseBodyCallback>);
254 void ClearPendingRequestData(); 258 void ClearPendingRequestData();
255 259
260 // This is null while inspecting workers.
256 Member<InspectedFrames> inspected_frames_; 261 Member<InspectedFrames> inspected_frames_;
262 // This is null while inspecting frames.
263 Member<WorkerGlobalScope> worker_global_scope_;
257 String host_id_; 264 String host_id_;
258 Member<NetworkResourcesData> resources_data_; 265 Member<NetworkResourcesData> resources_data_;
259 266
260 typedef HashMap<ThreadableLoaderClient*, unsigned long> 267 typedef HashMap<ThreadableLoaderClient*, unsigned long>
261 ThreadableLoaderClientRequestIdMap; 268 ThreadableLoaderClientRequestIdMap;
262 269
263 // Stores the pending ThreadableLoaderClient till an identifier for 270 // Stores the pending ThreadableLoaderClient till an identifier for
264 // the load is generated by the loader and passed to the inspector 271 // the load is generated by the loader and passed to the inspector
265 // via the documentThreadableLoaderStartedLoadingForClient() method. 272 // via the documentThreadableLoaderStartedLoadingForClient() method.
266 ThreadableLoaderClient* pending_request_; 273 ThreadableLoaderClient* pending_request_;
267 InspectorPageAgent::ResourceType pending_request_type_; 274 InspectorPageAgent::ResourceType pending_request_type_;
268 ThreadableLoaderClientRequestIdMap known_request_id_map_; 275 ThreadableLoaderClientRequestIdMap known_request_id_map_;
269 276
270 Member<XHRReplayData> pending_xhr_replay_data_; 277 Member<XHRReplayData> pending_xhr_replay_data_;
271 278
272 typedef HashMap<String, std::unique_ptr<protocol::Network::Initiator>> 279 typedef HashMap<String, std::unique_ptr<protocol::Network::Initiator>>
273 FrameNavigationInitiatorMap; 280 FrameNavigationInitiatorMap;
274 FrameNavigationInitiatorMap frame_navigation_initiator_map_; 281 FrameNavigationInitiatorMap frame_navigation_initiator_map_;
275 HashSet<String> frames_with_scheduled_navigation_; 282 HashSet<String> frames_with_scheduled_navigation_;
276 HashSet<String> frames_with_scheduled_client_navigation_; 283 HashSet<String> frames_with_scheduled_client_navigation_;
277 284
278 HeapHashSet<Member<XMLHttpRequest>> replay_xhrs_; 285 HeapHashSet<Member<XMLHttpRequest>> replay_xhrs_;
279 HeapHashSet<Member<XMLHttpRequest>> replay_xhrs_to_be_deleted_; 286 HeapHashSet<Member<XMLHttpRequest>> replay_xhrs_to_be_deleted_;
280 TaskRunnerTimer<InspectorNetworkAgent> remove_finished_replay_xhr_timer_; 287 TaskRunnerTimer<InspectorNetworkAgent> remove_finished_replay_xhr_timer_;
281 }; 288 };
282 289
283 } // namespace blink 290 } // namespace blink
284 291
285 #endif // !defined(InspectorNetworkAgent_h) 292 #endif // !defined(InspectorNetworkAgent_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698