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

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

Issue 2729613008: [instrumentation] Introduce InspectorTraceEvents agent (Closed)
Patch Set: all done Created 3 years, 9 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 fetchContext.dispatchWillSendRequest( 335 fetchContext.dispatchWillSendRequest(
336 m_identifier, passedNewRequest.toMutableResourceRequest(), 336 m_identifier, passedNewRequest.toMutableResourceRequest(),
337 passedRedirectResponse.toResourceResponse(), initiatorInfo); 337 passedRedirectResponse.toResourceResponse(), initiatorInfo);
338 } 338 }
339 339
340 return true; 340 return true;
341 } 341 }
342 342
343 void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) { 343 void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
344 if (frame()) { 344 if (frame()) {
345 TRACE_EVENT1(
346 "devtools.timeline", "ResourceFinish", "data",
347 InspectorResourceFinishEvent::data(m_identifier, 0, true, 0, 0));
348 const ResourceResponse& resourceResponse = response.toResourceResponse(); 345 const ResourceResponse& resourceResponse = response.toResourceResponse();
349 probe::didReceiveResourceResponse(frame(), m_identifier, 0, 346 probe::didReceiveResourceResponse(frame(), m_identifier, 0,
350 resourceResponse, 0); 347 resourceResponse, 0);
351 didFailLoading(frame()); 348 didFailLoading(frame());
352 } 349 }
353 dispose(); 350 dispose();
354 } 351 }
355 352
356 void PingLoaderImpl::didReceiveData(const char*, int dataLength) { 353 void PingLoaderImpl::didReceiveData(const char*, int dataLength) {
357 if (frame()) { 354 if (frame())
358 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
359 InspectorResourceFinishEvent::data(m_identifier, 0, true,
360 dataLength, 0));
361 didFailLoading(frame()); 355 didFailLoading(frame());
362 }
363 dispose(); 356 dispose();
364 } 357 }
365 358
366 void PingLoaderImpl::didFinishLoading(double, 359 void PingLoaderImpl::didFinishLoading(double,
367 int64_t, 360 int64_t,
368 int64_t encodedDataLength) { 361 int64_t encodedDataLength) {
369 if (frame()) { 362 if (frame())
370 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
371 InspectorResourceFinishEvent::data(m_identifier, 0, true,
372 encodedDataLength, 0));
373 didFailLoading(frame()); 363 didFailLoading(frame());
374 }
375 dispose(); 364 dispose();
376 } 365 }
377 366
378 void PingLoaderImpl::didFail(const WebURLError& resourceError, 367 void PingLoaderImpl::didFail(const WebURLError& resourceError,
379 int64_t, 368 int64_t,
380 int64_t encodedDataLength) { 369 int64_t encodedDataLength) {
381 if (frame()) { 370 if (frame())
382 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
383 InspectorResourceFinishEvent::data(m_identifier, 0, true,
384 encodedDataLength, 0));
385 didFailLoading(frame()); 371 didFailLoading(frame());
386 }
387 dispose(); 372 dispose();
388 } 373 }
389 374
390 void PingLoaderImpl::timeout(TimerBase*) { 375 void PingLoaderImpl::timeout(TimerBase*) {
391 if (frame()) { 376 if (frame())
392 TRACE_EVENT1(
393 "devtools.timeline", "ResourceFinish", "data",
394 InspectorResourceFinishEvent::data(m_identifier, 0, true, 0, 0));
395 didFailLoading(frame()); 377 didFailLoading(frame());
396 }
397 dispose(); 378 dispose();
398 } 379 }
399 380
400 void PingLoaderImpl::didFailLoading(LocalFrame* frame) { 381 void PingLoaderImpl::didFailLoading(LocalFrame* frame) {
401 probe::didFailLoading(frame, m_identifier, 382 probe::didFailLoading(frame, m_identifier,
402 ResourceError::cancelledError(m_url)); 383 ResourceError::cancelledError(m_url));
403 frame->console().didFailLoading(m_identifier, 384 frame->console().didFailLoading(m_identifier,
404 ResourceError::cancelledError(m_url)); 385 ResourceError::cancelledError(m_url));
405 } 386 }
406 387
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 bool PingLoader::sendBeacon(LocalFrame* frame, 557 bool PingLoader::sendBeacon(LocalFrame* frame,
577 int allowance, 558 int allowance,
578 const KURL& beaconURL, 559 const KURL& beaconURL,
579 Blob* data, 560 Blob* data,
580 int& payloadLength) { 561 int& payloadLength) {
581 BeaconBlob beacon(data); 562 BeaconBlob beacon(data);
582 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 563 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
583 } 564 }
584 565
585 } // namespace blink 566 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | third_party/WebKit/Source/web/WebDevToolsAgentImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698