| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PlatformTraceEventsAgent_h | 5 #include "platform/probe/PlatformProbes.h" |
| 6 #define PlatformTraceEventsAgent_h | |
| 7 | |
| 8 #include "platform/PlatformExport.h" | |
| 9 #include "platform/heap/Heap.h" | |
| 10 #include "platform/instrumentation/tracing/TraceEvent.h" | |
| 11 | 6 |
| 12 namespace blink { | 7 namespace blink { |
| 8 namespace probe { |
| 13 | 9 |
| 14 namespace probe { | 10 double ProbeBase::captureStartTime() const { |
| 15 class PlatformSendRequest; | 11 if (!m_startTime) |
| 12 m_startTime = monotonicallyIncreasingTime(); |
| 13 return m_startTime; |
| 16 } | 14 } |
| 17 | 15 |
| 18 class PLATFORM_EXPORT PlatformTraceEventsAgent | 16 double ProbeBase::captureEndTime() const { |
| 19 : public GarbageCollected<PlatformTraceEventsAgent> { | 17 if (!m_endTime) |
| 20 public: | 18 m_endTime = monotonicallyIncreasingTime(); |
| 21 DEFINE_INLINE_TRACE() {} | 19 return m_endTime; |
| 20 } |
| 22 | 21 |
| 23 void will(const probe::PlatformSendRequest&); | 22 double ProbeBase::duration() const { |
| 24 void did(const probe::PlatformSendRequest&); | 23 DCHECK(m_startTime); |
| 25 }; | 24 return captureEndTime() - m_startTime; |
| 25 } |
| 26 | 26 |
| 27 } // namespace probe |
| 27 } // namespace blink | 28 } // namespace blink |
| 28 | |
| 29 #endif // !defined(PlatformTraceEventsAgent_h) | |
| OLD | NEW |