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

Side by Side Diff: third_party/WebKit/Source/core/loader/PingLoader.cpp

Issue 2537753002: Remove WebURLLoader* argument from WebURLLoaderClient methods (Closed)
Patch Set: a Created 4 years 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 StoredCredentials, 199 StoredCredentials,
200 bool); 200 bool);
201 ~PingLoaderImpl() override; 201 ~PingLoaderImpl() override;
202 202
203 DECLARE_VIRTUAL_TRACE(); 203 DECLARE_VIRTUAL_TRACE();
204 204
205 private: 205 private:
206 void dispose(); 206 void dispose();
207 207
208 // WebURLLoaderClient 208 // WebURLLoaderClient
209 bool willFollowRedirect(WebURLLoader*, 209 bool willFollowRedirect(WebURLRequest&, const WebURLResponse&) override;
210 WebURLRequest&, 210 void didReceiveResponse(const WebURLResponse&) final;
211 const WebURLResponse&) override; 211 void didReceiveData(const char*, int, int) final;
212 void didReceiveResponse(WebURLLoader*, const WebURLResponse&) final; 212 void didFinishLoading(double, int64_t, int64_t) final;
213 void didReceiveData(WebURLLoader*, const char*, int, int) final; 213 void didFail(const WebURLError&, int64_t, int64_t) final;
214 void didFinishLoading(WebURLLoader*, double, int64_t, int64_t) final;
215 void didFail(WebURLLoader*, const WebURLError&, int64_t, int64_t) final;
216 214
217 void timeout(TimerBase*); 215 void timeout(TimerBase*);
218 216
219 void didFailLoading(LocalFrame*); 217 void didFailLoading(LocalFrame*);
220 218
221 std::unique_ptr<WebURLLoader> m_loader; 219 std::unique_ptr<WebURLLoader> m_loader;
222 Timer<PingLoaderImpl> m_timeout; 220 Timer<PingLoaderImpl> m_timeout;
223 String m_url; 221 String m_url;
224 unsigned long m_identifier; 222 unsigned long m_identifier;
225 SelfKeepAlive<PingLoaderImpl> m_keepAlive; 223 SelfKeepAlive<PingLoaderImpl> m_keepAlive;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void PingLoaderImpl::dispose() { 282 void PingLoaderImpl::dispose() {
285 if (m_loader) { 283 if (m_loader) {
286 m_loader->cancel(); 284 m_loader->cancel();
287 m_loader = nullptr; 285 m_loader = nullptr;
288 } 286 }
289 m_timeout.stop(); 287 m_timeout.stop();
290 m_keepAlive.clear(); 288 m_keepAlive.clear();
291 } 289 }
292 290
293 bool PingLoaderImpl::willFollowRedirect( 291 bool PingLoaderImpl::willFollowRedirect(
294 WebURLLoader*,
295 WebURLRequest& passedNewRequest, 292 WebURLRequest& passedNewRequest,
296 const WebURLResponse& passedRedirectResponse) { 293 const WebURLResponse& passedRedirectResponse) {
297 if (!m_isBeacon) 294 if (!m_isBeacon)
298 return true; 295 return true;
299 296
300 if (m_corsMode == NotCORSEnabled) 297 if (m_corsMode == NotCORSEnabled)
301 return true; 298 return true;
302 299
303 DCHECK(passedNewRequest.allowStoredCredentials()); 300 DCHECK(passedNewRequest.allowStoredCredentials());
304 301
(...skipping 21 matching lines...) Expand all
326 dispose(); 323 dispose();
327 324
328 return false; 325 return false;
329 } 326 }
330 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of 327 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of
331 // Origin: following this successful redirect. 328 // Origin: following this successful redirect.
332 329
333 return true; 330 return true;
334 } 331 }
335 332
336 void PingLoaderImpl::didReceiveResponse(WebURLLoader*, 333 void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
337 const WebURLResponse& response) {
338 if (LocalFrame* frame = this->frame()) { 334 if (LocalFrame* frame = this->frame()) {
339 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 335 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
340 InspectorResourceFinishEvent::data(m_identifier, 0, true)); 336 InspectorResourceFinishEvent::data(m_identifier, 0, true));
341 const ResourceResponse& resourceResponse = response.toResourceResponse(); 337 const ResourceResponse& resourceResponse = response.toResourceResponse();
342 InspectorInstrumentation::didReceiveResourceResponse(frame, m_identifier, 0, 338 InspectorInstrumentation::didReceiveResourceResponse(frame, m_identifier, 0,
343 resourceResponse, 0); 339 resourceResponse, 0);
344 didFailLoading(frame); 340 didFailLoading(frame);
345 } 341 }
346 dispose(); 342 dispose();
347 } 343 }
348 344
349 void PingLoaderImpl::didReceiveData(WebURLLoader*, const char*, int, int) { 345 void PingLoaderImpl::didReceiveData(const char*, int, int) {
350 if (LocalFrame* frame = this->frame()) { 346 if (LocalFrame* frame = this->frame()) {
351 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 347 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
352 InspectorResourceFinishEvent::data(m_identifier, 0, true)); 348 InspectorResourceFinishEvent::data(m_identifier, 0, true));
353 didFailLoading(frame); 349 didFailLoading(frame);
354 } 350 }
355 dispose(); 351 dispose();
356 } 352 }
357 353
358 void PingLoaderImpl::didFinishLoading(WebURLLoader*, double, int64_t, int64_t) { 354 void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
359 if (LocalFrame* frame = this->frame()) { 355 if (LocalFrame* frame = this->frame()) {
360 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 356 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
361 InspectorResourceFinishEvent::data(m_identifier, 0, true)); 357 InspectorResourceFinishEvent::data(m_identifier, 0, true));
362 didFailLoading(frame); 358 didFailLoading(frame);
363 } 359 }
364 dispose(); 360 dispose();
365 } 361 }
366 362
367 void PingLoaderImpl::didFail(WebURLLoader*, 363 void PingLoaderImpl::didFail(const WebURLError& resourceError,
368 const WebURLError& resourceError,
369 int64_t, 364 int64_t,
370 int64_t) { 365 int64_t) {
371 if (LocalFrame* frame = this->frame()) { 366 if (LocalFrame* frame = this->frame()) {
372 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 367 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
373 InspectorResourceFinishEvent::data(m_identifier, 0, true)); 368 InspectorResourceFinishEvent::data(m_identifier, 0, true));
374 didFailLoading(frame); 369 didFailLoading(frame);
375 } 370 }
376 dispose(); 371 dispose();
377 } 372 }
378 373
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 bool PingLoader::sendBeacon(LocalFrame* frame, 553 bool PingLoader::sendBeacon(LocalFrame* frame,
559 int allowance, 554 int allowance,
560 const KURL& beaconURL, 555 const KURL& beaconURL,
561 Blob* data, 556 Blob* data,
562 int& payloadLength) { 557 int& payloadLength) {
563 BeaconBlob beacon(data); 558 BeaconBlob beacon(data);
564 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 559 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
565 } 560 }
566 561
567 } // namespace blink 562 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698