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