• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkEventTracingPriv_DEFINED
9 #define SkEventTracingPriv_DEFINED
10 
11 #include "SkMutex.h"
12 
13 /**
14  * Construct and install an SkEventTracer, based on the mode,
15  * defaulting to the --trace command line argument.
16  */
17 void initializeEventTracingForTools(const char* mode = nullptr);
18 
19 /**
20  * Helper class used by internal implementations of SkEventTracer to manage categories.
21  */
22 class SkEventTracingCategories {
23 public:
SkEventTracingCategories()24     SkEventTracingCategories() : fNumCategories(0) {}
25 
26     uint8_t* getCategoryGroupEnabled(const char* name);
27     const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag);
28 
29 private:
30     enum { kMaxCategories = 256 };
31 
32     struct CategoryState {
33         uint8_t fEnabled;
34         const char* fName;
35     };
36 
37     CategoryState fCategories[kMaxCategories];
38     int fNumCategories;
39     SkMutex fMutex;
40 };
41 
42 #endif
43