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/PerformanceBase.h

Issue 2343553005: enable / disable Long Task instrumentation based on presence of LongTask observer (Closed)
Patch Set: Created 4 years, 3 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 * 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; 56 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>;
57 57
58 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData { 58 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData {
59 public: 59 public:
60 ~PerformanceBase() override; 60 ~PerformanceBase() override;
61 61
62 const AtomicString& interfaceName() const override; 62 const AtomicString& interfaceName() const override;
63 63
64 virtual PerformanceTiming* timing() const; 64 virtual PerformanceTiming* timing() const;
65 65
66 virtual void enableLongTaskInstrumentation() const {}
67 virtual void disableLongTaskInstrumentation() const {}
caseq 2016/09/15 23:29:40 Why are these two const? I find it to be a bit art
panicker 2016/09/16 17:07:58 Done.
68
66 // Reduce the resolution to 5µs to prevent timing attacks. See: 69 // Reduce the resolution to 5µs to prevent timing attacks. See:
67 // http://www.w3.org/TR/hr-time-2/#privacy-security 70 // http://www.w3.org/TR/hr-time-2/#privacy-security
68 static double clampTimeResolution(double timeSeconds); 71 static double clampTimeResolution(double timeSeconds);
69 72
70 // Translate given platform monotonic time in seconds into a high resolution 73 // Translate given platform monotonic time in seconds into a high resolution
71 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to 74 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to
72 // document's time origin and has a time resolution that is safe for 75 // document's time origin and has a time resolution that is safe for
73 // exposing to web. 76 // exposing to web.
74 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; 77 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const;
75 double monotonicTimeToDOMHighResTimeStampInMillis(DOMHighResTimeStamp) const ; 78 double monotonicTimeToDOMHighResTimeStampInMillis(DOMHighResTimeStamp) const ;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 bool isResourceTimingBufferFull(); 128 bool isResourceTimingBufferFull();
126 void addResourceTimingBuffer(PerformanceEntry&); 129 void addResourceTimingBuffer(PerformanceEntry&);
127 130
128 bool isFrameTimingBufferFull(); 131 bool isFrameTimingBufferFull();
129 void addFrameTimingBuffer(PerformanceEntry&); 132 void addFrameTimingBuffer(PerformanceEntry&);
130 133
131 bool isLongTaskTimingBufferFull(); 134 bool isLongTaskTimingBufferFull();
132 void addLongTaskTimingBuffer(PerformanceEntry&); 135 void addLongTaskTimingBuffer(PerformanceEntry&);
133 136
134 void notifyObserversOfEntry(PerformanceEntry&); 137 void notifyObserversOfEntry(PerformanceEntry&);
135 bool hasObserverFor(PerformanceEntry::EntryType); 138 bool hasObserverFor(PerformanceEntry::EntryType) const;
136 139
137 void deliverObservationsTimerFired(TimerBase*); 140 void deliverObservationsTimerFired(TimerBase*);
138 141
139 PerformanceEntryVector m_frameTimingBuffer; 142 PerformanceEntryVector m_frameTimingBuffer;
140 unsigned m_frameTimingBufferSize; 143 unsigned m_frameTimingBufferSize;
141 PerformanceEntryVector m_resourceTimingBuffer; 144 PerformanceEntryVector m_resourceTimingBuffer;
142 unsigned m_resourceTimingBufferSize; 145 unsigned m_resourceTimingBufferSize;
143 PerformanceEntryVector m_longTaskTimingBuffer; 146 PerformanceEntryVector m_longTaskTimingBuffer;
144 unsigned m_longTaskTimingBufferSize; 147 unsigned m_longTaskTimingBufferSize;
145 Member<UserTiming> m_userTiming; 148 Member<UserTiming> m_userTiming;
146 149
147 double m_timeOrigin; 150 double m_timeOrigin;
148 151
149 PerformanceEntryTypeMask m_observerFilterOptions; 152 PerformanceEntryTypeMask m_observerFilterOptions;
150 PerformanceObservers m_observers; 153 PerformanceObservers m_observers;
151 PerformanceObservers m_activeObservers; 154 PerformanceObservers m_activeObservers;
152 PerformanceObservers m_suspendedObservers; 155 PerformanceObservers m_suspendedObservers;
153 Timer<PerformanceBase> m_deliverObservationsTimer; 156 Timer<PerformanceBase> m_deliverObservationsTimer;
154 }; 157 };
155 158
156 } // namespace blink 159 } // namespace blink
157 160
158 #endif // PerformanceBase_h 161 #endif // PerformanceBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698