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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceTiming.cpp

Issue 1511583002: Client Side Speed Index Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 unsigned long long PerformanceTiming::firstImagePaint() const 346 unsigned long long PerformanceTiming::firstImagePaint() const
347 { 347 {
348 const PaintTiming* timing = paintTiming(); 348 const PaintTiming* timing = paintTiming();
349 if (!timing) 349 if (!timing)
350 return 0; 350 return 0;
351 351
352 return monotonicTimeToIntegerMilliseconds(timing->firstImagePaint()); 352 return monotonicTimeToIntegerMilliseconds(timing->firstImagePaint());
353 } 353 }
354 354
355 double PerformanceTiming::speedIndex() const
356 {
357 const PaintTiming* paintTime = paintTiming();
358 DocumentLoadTiming* loadTime = documentLoadTiming();
359 if (!paintTime || !loadTime)
360 return 0;
361
362 double navigationStart = loadTime->navigationStart();
363 if (!navigationStart)
364 return 0;
365
366 double speedIndex = paintTime->speedIndex(navigationStart);
367 return speedIndex;
368 }
369
355 DocumentLoader* PerformanceTiming::documentLoader() const 370 DocumentLoader* PerformanceTiming::documentLoader() const
356 { 371 {
357 if (!m_frame) 372 if (!m_frame)
358 return nullptr; 373 return nullptr;
359 374
360 return m_frame->loader().documentLoader(); 375 return m_frame->loader().documentLoader();
361 } 376 }
362 377
363 const DocumentTiming* PerformanceTiming::documentTiming() const 378 const DocumentTiming* PerformanceTiming::documentTiming() const
364 { 379 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 462
448 return timing->pseudoWallTimeToMonotonicTime(toDoubleSeconds(integerMillisec onds)); 463 return timing->pseudoWallTimeToMonotonicTime(toDoubleSeconds(integerMillisec onds));
449 } 464 }
450 465
451 DEFINE_TRACE(PerformanceTiming) 466 DEFINE_TRACE(PerformanceTiming)
452 { 467 {
453 DOMWindowProperty::trace(visitor); 468 DOMWindowProperty::trace(visitor);
454 } 469 }
455 470
456 } // namespace blink 471 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceTiming.h ('k') | third_party/WebKit/Source/platform/graphics/GraphicsLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698