OLD | NEW |
1 // Copyright (c) 2014 Google Inc. | 1 // Copyright (c) 2014 Google Inc. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 // This header file defines implementation details of how the trace macros in | 6 // This header file defines implementation details of how the trace macros in |
7 // SkTraceEventCommon.h collect and store trace events. Anything not | 7 // SkTraceEventCommon.h collect and store trace events. Anything not |
8 // implementation-specific should go in SkTraceEventCommon.h instead of here. | 8 // implementation-specific should go in SkTraceEventCommon.h instead of here. |
9 | 9 |
10 #ifndef SkTraceEvent_DEFINED | 10 #ifndef SkTraceEvent_DEFINED |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 static inline SkEventTracer::Handle | 389 static inline SkEventTracer::Handle |
390 AddTraceEvent( | 390 AddTraceEvent( |
391 char phase, | 391 char phase, |
392 const uint8_t* category_group_enabled, | 392 const uint8_t* category_group_enabled, |
393 const char* name, | 393 const char* name, |
394 uint64_t id, | 394 uint64_t id, |
395 unsigned char flags) { | 395 unsigned char flags) { |
396 return TRACE_EVENT_API_ADD_TRACE_EVENT( | 396 return TRACE_EVENT_API_ADD_TRACE_EVENT( |
397 phase, category_group_enabled, name, id, | 397 phase, category_group_enabled, name, id, |
398 kZeroNumArgs, NULL, NULL, NULL, flags); | 398 kZeroNumArgs, nullptr, nullptr, nullptr, flags); |
399 } | 399 } |
400 | 400 |
401 template<class ARG1_TYPE> | 401 template<class ARG1_TYPE> |
402 static inline SkEventTracer::Handle | 402 static inline SkEventTracer::Handle |
403 AddTraceEvent( | 403 AddTraceEvent( |
404 char phase, | 404 char phase, |
405 const uint8_t* category_group_enabled, | 405 const uint8_t* category_group_enabled, |
406 const char* name, | 406 const char* name, |
407 uint64_t id, | 407 uint64_t id, |
408 unsigned char flags, | 408 unsigned char flags, |
(...skipping 28 matching lines...) Expand all Loading... |
437 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 437 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
438 return TRACE_EVENT_API_ADD_TRACE_EVENT( | 438 return TRACE_EVENT_API_ADD_TRACE_EVENT( |
439 phase, category_group_enabled, name, id, | 439 phase, category_group_enabled, name, id, |
440 num_args, arg_names, arg_types, arg_values, flags); | 440 num_args, arg_names, arg_types, arg_values, flags); |
441 } | 441 } |
442 | 442 |
443 // Used by TRACE_EVENTx macros. Do not use directly. | 443 // Used by TRACE_EVENTx macros. Do not use directly. |
444 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { | 444 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
445 public: | 445 public: |
446 // Note: members of data_ intentionally left uninitialized. See Initialize. | 446 // Note: members of data_ intentionally left uninitialized. See Initialize. |
447 ScopedTracer() : p_data_(NULL) {} | 447 ScopedTracer() : p_data_(nullptr) {} |
448 | 448 |
449 ~ScopedTracer() { | 449 ~ScopedTracer() { |
450 if (p_data_ && *data_.category_group_enabled) | 450 if (p_data_ && *data_.category_group_enabled) |
451 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 451 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
452 data_.category_group_enabled, data_.name, data_.event_handle); | 452 data_.category_group_enabled, data_.name, data_.event_handle); |
453 } | 453 } |
454 | 454 |
455 void Initialize(const uint8_t* category_group_enabled, | 455 void Initialize(const uint8_t* category_group_enabled, |
456 const char* name, | 456 const char* name, |
457 SkEventTracer::Handle event_handle) { | 457 SkEventTracer::Handle event_handle) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 | 526 |
527 private: | 527 private: |
528 const char* previous_state_; | 528 const char* previous_state_; |
529 }; | 529 }; |
530 | 530 |
531 } // namespace tracing_internals | 531 } // namespace tracing_internals |
532 } // namespace skia | 532 } // namespace skia |
533 | 533 |
534 #endif | 534 #endif |
OLD | NEW |