| 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 PlatformInstrumentation_h | 5 #ifndef PlatformInstrumentation_h |
| 6 #define PlatformInstrumentation_h | 6 #define PlatformInstrumentation_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 10 #include "platform/loader/fetch/FetchContext.h" | 10 #include "wtf/text/WTFString.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class FetchContext; | |
| 15 class PlatformInstrumentationAgents; | |
| 16 | |
| 17 namespace probe { | |
| 18 | |
| 19 class PLATFORM_EXPORT ProbeBase { | |
| 20 STACK_ALLOCATED() | |
| 21 | |
| 22 public: | |
| 23 double captureStartTime() const; | |
| 24 double captureEndTime() const; | |
| 25 double duration() const; | |
| 26 | |
| 27 private: | |
| 28 mutable double m_startTime = 0; | |
| 29 mutable double m_endTime = 0; | |
| 30 }; | |
| 31 | |
| 32 inline PlatformInstrumentationAgents* instrumentingAgentsFor( | |
| 33 FetchContext* context) { | |
| 34 return context->instrumentingAgents(); | |
| 35 } | |
| 36 | |
| 37 } // namespace probe | |
| 38 | |
| 39 class PLATFORM_EXPORT PlatformInstrumentation { | 14 class PLATFORM_EXPORT PlatformInstrumentation { |
| 40 public: | 15 public: |
| 41 class LazyPixelRefTracker : TraceEvent::TraceScopedTrackableObject<void*> { | 16 class LazyPixelRefTracker : TraceEvent::TraceScopedTrackableObject<void*> { |
| 42 public: | 17 public: |
| 43 LazyPixelRefTracker(void* instance) | 18 LazyPixelRefTracker(void* instance) |
| 44 : TraceEvent::TraceScopedTrackableObject<void*>(CategoryName, | 19 : TraceEvent::TraceScopedTrackableObject<void*>(CategoryName, |
| 45 LazyPixelRef, | 20 LazyPixelRef, |
| 46 instance) {} | 21 instance) {} |
| 47 }; | 22 }; |
| 48 | 23 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 TRACE_EVENT_BEGIN1(CategoryName, DecodeLazyPixelRefEvent, LazyPixelRef, | 61 TRACE_EVENT_BEGIN1(CategoryName, DecodeLazyPixelRefEvent, LazyPixelRef, |
| 87 lazyPixelRefId); | 62 lazyPixelRefId); |
| 88 } | 63 } |
| 89 | 64 |
| 90 inline void PlatformInstrumentation::didDecodeLazyPixelRef() { | 65 inline void PlatformInstrumentation::didDecodeLazyPixelRef() { |
| 91 TRACE_EVENT_END0(CategoryName, DecodeLazyPixelRefEvent); | 66 TRACE_EVENT_END0(CategoryName, DecodeLazyPixelRefEvent); |
| 92 } | 67 } |
| 93 | 68 |
| 94 } // namespace blink | 69 } // namespace blink |
| 95 | 70 |
| 96 #include "platform/PlatformInstrumentationInl.h" | |
| 97 | |
| 98 #endif // PlatformInstrumentation_h | 71 #endif // PlatformInstrumentation_h |
| OLD | NEW |