| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/timing/PerformanceTiming.h" | 31 #include "core/timing/PerformanceTiming.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptValue.h" | 33 #include "bindings/core/v8/ScriptValue.h" |
| 34 #include "bindings/core/v8/V8ObjectBuilder.h" | 34 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 35 #include "core/css/CSSTiming.h" |
| 35 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 36 #include "core/dom/DocumentParserTiming.h" | 37 #include "core/dom/DocumentParserTiming.h" |
| 37 #include "core/dom/DocumentTiming.h" | 38 #include "core/dom/DocumentTiming.h" |
| 38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
| 39 #include "core/loader/DocumentLoadTiming.h" | 40 #include "core/loader/DocumentLoadTiming.h" |
| 40 #include "core/loader/DocumentLoader.h" | 41 #include "core/loader/DocumentLoader.h" |
| 41 #include "core/loader/FrameLoader.h" | 42 #include "core/loader/FrameLoader.h" |
| 42 #include "core/paint/PaintTiming.h" | 43 #include "core/paint/PaintTiming.h" |
| 43 #include "core/timing/PerformanceBase.h" | 44 #include "core/timing/PerformanceBase.h" |
| 44 #include "platform/network/ResourceLoadTiming.h" | 45 #include "platform/network/ResourceLoadTiming.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 PerformanceTiming::parseBlockedOnScriptExecutionFromDocumentWriteDuration() | 396 PerformanceTiming::parseBlockedOnScriptExecutionFromDocumentWriteDuration() |
| 396 const { | 397 const { |
| 397 const DocumentParserTiming* timing = documentParserTiming(); | 398 const DocumentParserTiming* timing = documentParserTiming(); |
| 398 if (!timing) | 399 if (!timing) |
| 399 return 0; | 400 return 0; |
| 400 | 401 |
| 401 return toIntegerMilliseconds( | 402 return toIntegerMilliseconds( |
| 402 timing->parserBlockedOnScriptExecutionFromDocumentWriteDuration()); | 403 timing->parserBlockedOnScriptExecutionFromDocumentWriteDuration()); |
| 403 } | 404 } |
| 404 | 405 |
| 406 unsigned long long PerformanceTiming::authorStyleSheetParseDurationBeforeFCP() |
| 407 const { |
| 408 const CSSTiming* timing = cssTiming(); |
| 409 if (!timing) |
| 410 return 0; |
| 411 |
| 412 return toIntegerMilliseconds( |
| 413 timing->authorStyleSheetParseDurationBeforeFCP()); |
| 414 } |
| 415 |
| 405 DocumentLoader* PerformanceTiming::documentLoader() const { | 416 DocumentLoader* PerformanceTiming::documentLoader() const { |
| 406 if (!frame()) | 417 if (!frame()) |
| 407 return nullptr; | 418 return nullptr; |
| 408 | 419 |
| 409 return frame()->loader().documentLoader(); | 420 return frame()->loader().documentLoader(); |
| 410 } | 421 } |
| 411 | 422 |
| 412 const DocumentTiming* PerformanceTiming::documentTiming() const { | 423 const DocumentTiming* PerformanceTiming::documentTiming() const { |
| 413 if (!frame()) | 424 if (!frame()) |
| 414 return nullptr; | 425 return nullptr; |
| 415 | 426 |
| 416 Document* document = frame()->document(); | 427 Document* document = frame()->document(); |
| 417 if (!document) | 428 if (!document) |
| 418 return nullptr; | 429 return nullptr; |
| 419 | 430 |
| 420 return &document->timing(); | 431 return &document->timing(); |
| 421 } | 432 } |
| 422 | 433 |
| 423 const PaintTiming* PerformanceTiming::paintTiming() const { | 434 const PaintTiming* PerformanceTiming::paintTiming() const { |
| 424 if (!frame()) | 435 if (!frame()) |
| 425 return nullptr; | 436 return nullptr; |
| 426 | 437 |
| 427 Document* document = frame()->document(); | 438 Document* document = frame()->document(); |
| 428 if (!document) | 439 if (!document) |
| 429 return nullptr; | 440 return nullptr; |
| 430 | 441 |
| 431 return &PaintTiming::from(*document); | 442 return &PaintTiming::from(*document); |
| 432 } | 443 } |
| 433 | 444 |
| 445 const CSSTiming* PerformanceTiming::cssTiming() const { |
| 446 if (!frame()) |
| 447 return nullptr; |
| 448 |
| 449 Document* document = frame()->document(); |
| 450 if (!document) |
| 451 return nullptr; |
| 452 |
| 453 return &CSSTiming::from(*document); |
| 454 } |
| 455 |
| 434 const DocumentParserTiming* PerformanceTiming::documentParserTiming() const { | 456 const DocumentParserTiming* PerformanceTiming::documentParserTiming() const { |
| 435 if (!frame()) | 457 if (!frame()) |
| 436 return nullptr; | 458 return nullptr; |
| 437 | 459 |
| 438 Document* document = frame()->document(); | 460 Document* document = frame()->document(); |
| 439 if (!document) | 461 if (!document) |
| 440 return nullptr; | 462 return nullptr; |
| 441 | 463 |
| 442 return &DocumentParserTiming::from(*document); | 464 return &DocumentParserTiming::from(*document); |
| 443 } | 465 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 526 |
| 505 return timing->pseudoWallTimeToMonotonicTime( | 527 return timing->pseudoWallTimeToMonotonicTime( |
| 506 toDoubleSeconds(integerMilliseconds)); | 528 toDoubleSeconds(integerMilliseconds)); |
| 507 } | 529 } |
| 508 | 530 |
| 509 DEFINE_TRACE(PerformanceTiming) { | 531 DEFINE_TRACE(PerformanceTiming) { |
| 510 DOMWindowProperty::trace(visitor); | 532 DOMWindowProperty::trace(visitor); |
| 511 } | 533 } |
| 512 | 534 |
| 513 } // namespace blink | 535 } // namespace blink |
| OLD | NEW |