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

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

Issue 2883353002: Replace ASSERT with DCHECK_LE/GE/GT/LT/NE as appropriate (Closed)
Patch Set: DCHECK in BluetoothCharacteristicProperties.cpp Created 3 years, 7 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/loader/FrameLoader.h" 42 #include "core/loader/FrameLoader.h"
43 #include "core/paint/PaintTiming.h" 43 #include "core/paint/PaintTiming.h"
44 #include "core/timing/PerformanceBase.h" 44 #include "core/timing/PerformanceBase.h"
45 #include "platform/loader/fetch/ResourceLoadTiming.h" 45 #include "platform/loader/fetch/ResourceLoadTiming.h"
46 #include "platform/loader/fetch/ResourceResponse.h" 46 #include "platform/loader/fetch/ResourceResponse.h"
47 47
48 // Legacy support for NT1(https://www.w3.org/TR/navigation-timing/). 48 // Legacy support for NT1(https://www.w3.org/TR/navigation-timing/).
49 namespace blink { 49 namespace blink {
50 50
51 static unsigned long long ToIntegerMilliseconds(double seconds) { 51 static unsigned long long ToIntegerMilliseconds(double seconds) {
52 ASSERT(seconds >= 0); 52 DCHECK_GE(seconds, 0);
53 double clamped_seconds = PerformanceBase::ClampTimeResolution(seconds); 53 double clamped_seconds = PerformanceBase::ClampTimeResolution(seconds);
54 return static_cast<unsigned long long>(clamped_seconds * 1000.0); 54 return static_cast<unsigned long long>(clamped_seconds * 1000.0);
55 } 55 }
56 56
57 static double ToDoubleSeconds(unsigned long long integer_milliseconds) { 57 static double ToDoubleSeconds(unsigned long long integer_milliseconds) {
58 return integer_milliseconds / 1000.0; 58 return integer_milliseconds / 1000.0;
59 } 59 }
60 60
61 PerformanceTiming::PerformanceTiming(LocalFrame* frame) 61 PerformanceTiming::PerformanceTiming(LocalFrame* frame)
62 : DOMWindowClient(frame) {} 62 : DOMWindowClient(frame) {}
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 result.AddNumber("domContentLoadedEventStart", domContentLoadedEventStart()); 511 result.AddNumber("domContentLoadedEventStart", domContentLoadedEventStart());
512 result.AddNumber("domContentLoadedEventEnd", domContentLoadedEventEnd()); 512 result.AddNumber("domContentLoadedEventEnd", domContentLoadedEventEnd());
513 result.AddNumber("domComplete", domComplete()); 513 result.AddNumber("domComplete", domComplete());
514 result.AddNumber("loadEventStart", loadEventStart()); 514 result.AddNumber("loadEventStart", loadEventStart());
515 result.AddNumber("loadEventEnd", loadEventEnd()); 515 result.AddNumber("loadEventEnd", loadEventEnd());
516 return result.GetScriptValue(); 516 return result.GetScriptValue();
517 } 517 }
518 518
519 unsigned long long PerformanceTiming::MonotonicTimeToIntegerMilliseconds( 519 unsigned long long PerformanceTiming::MonotonicTimeToIntegerMilliseconds(
520 double monotonic_seconds) const { 520 double monotonic_seconds) const {
521 ASSERT(monotonic_seconds >= 0); 521 DCHECK_GE(monotonic_seconds, 0);
522 const DocumentLoadTiming* timing = GetDocumentLoadTiming(); 522 const DocumentLoadTiming* timing = GetDocumentLoadTiming();
523 if (!timing) 523 if (!timing)
524 return 0; 524 return 0;
525 525
526 return ToIntegerMilliseconds( 526 return ToIntegerMilliseconds(
527 timing->MonotonicTimeToPseudoWallTime(monotonic_seconds)); 527 timing->MonotonicTimeToPseudoWallTime(monotonic_seconds));
528 } 528 }
529 529
530 double PerformanceTiming::IntegerMillisecondsToMonotonicTime( 530 double PerformanceTiming::IntegerMillisecondsToMonotonicTime(
531 unsigned long long integer_milliseconds) const { 531 unsigned long long integer_milliseconds) const {
532 const DocumentLoadTiming* timing = GetDocumentLoadTiming(); 532 const DocumentLoadTiming* timing = GetDocumentLoadTiming();
533 if (!timing) 533 if (!timing)
534 return 0; 534 return 0;
535 535
536 return timing->PseudoWallTimeToMonotonicTime( 536 return timing->PseudoWallTimeToMonotonicTime(
537 ToDoubleSeconds(integer_milliseconds)); 537 ToDoubleSeconds(integer_milliseconds));
538 } 538 }
539 539
540 DEFINE_TRACE(PerformanceTiming) { 540 DEFINE_TRACE(PerformanceTiming) {
541 DOMWindowClient::Trace(visitor); 541 DOMWindowClient::Trace(visitor);
542 } 542 }
543 543
544 } // namespace blink 544 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698