Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | 5 #ifndef BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |
| 6 #define BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | 6 #define BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <inttypes.h> | 8 #include <inttypes.h> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/threading/thread_checker.h" | |
| 12 #include "base/trace_event/trace_log.h" | 13 #include "base/trace_event/trace_log.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 namespace trace_event { | 16 namespace trace_event { |
| 16 class TracedValue; | 17 class TracedValue; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace trace_event { | 20 namespace trace_event { |
| 20 | 21 |
| 21 // A blame context represents a logical unit to which we want to attribute | 22 // A blame context represents a logical unit to which we want to attribute |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 | 97 |
| 97 // trace_event::TraceLog::EnabledStateObserver implementation: | 98 // trace_event::TraceLog::EnabledStateObserver implementation: |
| 98 void OnTraceLogEnabled() override; | 99 void OnTraceLogEnabled() override; |
| 99 void OnTraceLogDisabled() override; | 100 void OnTraceLogDisabled() override; |
| 100 | 101 |
| 101 protected: | 102 protected: |
| 102 // Serialize the properties of this blame context into |state|. Subclasses can | 103 // Serialize the properties of this blame context into |state|. Subclasses can |
| 103 // override this method to record additional properties (e.g, the URL for an | 104 // override this method to record additional properties (e.g, the URL for an |
| 104 // <iframe> blame context). Note that an overridden implementation must still | 105 // <iframe> blame context). Note that an overridden implementation must still |
| 105 // call this base method. | 106 // call this base method. |
| 106 virtual void AsValueInto(trace_event::TracedValue* state); | 107 virtual void AsValueInto(trace_event::TracedValue* state); |
|
Sami
2016/04/26 12:57:12
Could you add a note here saying that this is alwa
Xiaocheng
2016/04/27 12:21:10
A note on thread safety is added before the class
| |
| 107 | 108 |
| 108 private: | 109 private: |
| 109 bool WasInitialized() const; | 110 bool WasInitialized() const; |
| 110 | 111 |
| 111 // The following string pointers have application lifetime. | 112 // The following string pointers have application lifetime. |
| 112 const char* category_; | 113 const char* category_; |
| 113 const char* name_; | 114 const char* name_; |
| 114 const char* type_; | 115 const char* type_; |
| 115 const char* scope_; | 116 const char* scope_; |
| 116 const int64_t id_; | 117 const int64_t id_; |
| 117 | 118 |
| 118 const char* parent_scope_; | 119 const char* parent_scope_; |
| 119 const int64_t parent_id_; | 120 const int64_t parent_id_; |
| 120 | 121 |
| 121 const unsigned char* category_group_enabled_; | 122 const unsigned char* category_group_enabled_; |
| 122 | 123 |
| 124 ThreadChecker thread_checker_; | |
| 125 scoped_refptr<SingleThreadTaskRunner> task_runner_; | |
| 126 WeakPtrFactory<BlameContext> weak_factory_; | |
| 127 | |
| 123 DISALLOW_COPY_AND_ASSIGN(BlameContext); | 128 DISALLOW_COPY_AND_ASSIGN(BlameContext); |
| 124 }; | 129 }; |
| 125 | 130 |
| 126 } // namespace trace_event | 131 } // namespace trace_event |
| 127 } // namespace base | 132 } // namespace base |
| 128 | 133 |
| 129 #endif // BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | 134 #endif // BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |
| OLD | NEW |