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

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

Issue 2593853002: Remove unnecessary wrapper on DomHighResTimestamp, and clamp resolution to 1 millisecond (Closed)
Patch Set: address format nit 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 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 void PerformanceBase::addLongTaskTiming(double startTime, 427 void PerformanceBase::addLongTaskTiming(double startTime,
428 double endTime, 428 double endTime,
429 const String& name, 429 const String& name,
430 const String& culpritFrameSrc, 430 const String& culpritFrameSrc,
431 const String& culpritFrameId, 431 const String& culpritFrameId,
432 const String& culpritFrameName) { 432 const String& culpritFrameName) {
433 if (!hasObserverFor(PerformanceEntry::LongTask)) 433 if (!hasObserverFor(PerformanceEntry::LongTask))
434 return; 434 return;
435 PerformanceEntry* entry = PerformanceLongTaskTiming::create( 435 PerformanceEntry* entry = PerformanceLongTaskTiming::create(
436 monotonicTimeToDOMHighResTimeStampInMillis(startTime), 436 monotonicTimeToDOMHighResTimeStamp(startTime),
437 monotonicTimeToDOMHighResTimeStampInMillis(endTime), name, 437 monotonicTimeToDOMHighResTimeStamp(endTime), name, culpritFrameSrc,
438 culpritFrameSrc, culpritFrameId, culpritFrameName); 438 culpritFrameId, culpritFrameName);
439 notifyObserversOfEntry(*entry); 439 notifyObserversOfEntry(*entry);
440 } 440 }
441 441
442 void PerformanceBase::mark(const String& markName, 442 void PerformanceBase::mark(const String& markName,
443 ExceptionState& exceptionState) { 443 ExceptionState& exceptionState) {
444 if (!m_userTiming) 444 if (!m_userTiming)
445 m_userTiming = UserTiming::create(*this); 445 m_userTiming = UserTiming::create(*this);
446 if (PerformanceEntry* entry = m_userTiming->mark(markName, exceptionState)) 446 if (PerformanceEntry* entry = m_userTiming->mark(markName, exceptionState))
447 notifyObserversOfEntry(*entry); 447 notifyObserversOfEntry(*entry);
448 } 448 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 double monotonicTime) const { 555 double monotonicTime) const {
556 // Avoid exposing raw platform timestamps. 556 // Avoid exposing raw platform timestamps.
557 if (m_timeOrigin == 0.0) 557 if (m_timeOrigin == 0.0)
558 return 0.0; 558 return 0.0;
559 559
560 double timeInSeconds = monotonicTime - m_timeOrigin; 560 double timeInSeconds = monotonicTime - m_timeOrigin;
561 return convertSecondsToDOMHighResTimeStamp( 561 return convertSecondsToDOMHighResTimeStamp(
562 clampTimeResolution(timeInSeconds)); 562 clampTimeResolution(timeInSeconds));
563 } 563 }
564 564
565 double PerformanceBase::monotonicTimeToDOMHighResTimeStampInMillis(
566 DOMHighResTimeStamp monotonicTime) const {
567 return monotonicTimeToDOMHighResTimeStamp(monotonicTime) * 1000;
568 }
569
570 DOMHighResTimeStamp PerformanceBase::now() const { 565 DOMHighResTimeStamp PerformanceBase::now() const {
571 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime()); 566 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime());
572 } 567 }
573 568
574 DEFINE_TRACE(PerformanceBase) { 569 DEFINE_TRACE(PerformanceBase) {
575 visitor->trace(m_frameTimingBuffer); 570 visitor->trace(m_frameTimingBuffer);
576 visitor->trace(m_resourceTimingBuffer); 571 visitor->trace(m_resourceTimingBuffer);
577 visitor->trace(m_navigationTiming); 572 visitor->trace(m_navigationTiming);
578 visitor->trace(m_userTiming); 573 visitor->trace(m_userTiming);
579 visitor->trace(m_observers); 574 visitor->trace(m_observers);
580 visitor->trace(m_activeObservers); 575 visitor->trace(m_activeObservers);
581 visitor->trace(m_suspendedObservers); 576 visitor->trace(m_suspendedObservers);
582 EventTargetWithInlineData::trace(visitor); 577 EventTargetWithInlineData::trace(visitor);
583 } 578 }
584 579
585 } // namespace blink 580 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698