Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: base/trace_event/trace_event_etw_export_win.h

Issue 1213523003: [ETW Export] Add polling for ETW keyword. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};
« no previous file with comments | « no previous file | base/trace_event/trace_event_etw_export_win.cc » ('j') | base/trace_event/trace_event_etw_export_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698