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