Index: base/trace_event/trace_event_etw_export_win.h |
diff --git a/base/trace_event/trace_event_etw_export_win.h b/base/trace_event/trace_event_etw_export_win.h |
index a9b580c96090617d931f407f6ba1932a96e7d29a..3a6d08b7f1495ddf9ff5c140730de97cb403d1e2 100644 |
--- a/base/trace_event/trace_event_etw_export_win.h |
+++ b/base/trace_event/trace_event_etw_export_win.h |
@@ -10,6 +10,7 @@ |
#include "base/base_export.h" |
#include "base/strings/string_piece.h" |
+#include "base/timer/timer.h" |
#include "base/trace_event/trace_event_impl.h" |
// Fwd. |
@@ -32,9 +33,9 @@ class BASE_EXPORT TraceEventETWExport { |
static void EnableETWExport(); |
static void DisableETWExport(); |
- static bool IsETWExportEnabled() { |
- return (GetInstance() && GetInstance()->etw_match_any_keyword_); |
- } |
+ // Returns true if ETW is enabled. For now, this is true if the command line |
+ // flag is specified. |
+ static bool IsETWExportEnabled(); |
// Exports an event to ETW. This is mainly used in |
// TraceLog::AddTraceEventWithThreadIdAndTimestamp to export internal events. |
@@ -64,6 +65,11 @@ class BASE_EXPORT TraceEventETWExport { |
// Returns true if any category in the group is enabled. |
static bool IsCategoryGroupEnabled(const char* category_group_name); |
+ // Starts the timer that keeps polls the keyword for changes. |
+ static void StartKeywordUpdateTimer(); |
+ |
+ // Exposed for unittesting only, allows resurrecting our |
+ // singleton instance post-AtExit processing |
void Resurrect(); |
private: |
@@ -72,11 +78,15 @@ class BASE_EXPORT TraceEventETWExport { |
TraceEventETWExport(); |
// Updates the list of enabled categories by consulting the ETW keyword. |
- void UpdateEnabledCategories(); |
+ // Returns true if there was a change, false if unchanged. |
+ bool UpdateEnabledCategories(); |
// Returns true if the category is enabled. |
bool IsCategoryEnabled(const char* category_name) const; |
+ // Called back by the timer to check for potential changes to the keyword. |
+ static void KeywordUpdateTimerCallback(); |
+ |
// True if ETW is enabled. Allows hiding the exporting behind a flag. |
bool etw_export_enabled_; |
@@ -86,6 +96,9 @@ class BASE_EXPORT TraceEventETWExport { |
// Local copy of the ETW keyword. |
uint64 etw_match_any_keyword_; |
+ // Repeating timer that is responsible for polling the keyword for changes. |
+ base::RepeatingTimer<TraceEventETWExport> keyword_update_timer_; |
+ |
DISALLOW_COPY_AND_ASSIGN(TraceEventETWExport); |
}; |