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

Unified Diff: components/browser_watcher/exit_funnel_win.h

Issue 792163002: Add ExitFunnel to prepare for instrumenting browser exits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Add some more testing, make a start on pulling the reader to a standalone function. Created 6 years 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: components/browser_watcher/exit_funnel_win.h
diff --git a/components/browser_watcher/exit_funnel_win.h b/components/browser_watcher/exit_funnel_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..e1c8f76a40cab724ec46b99d3c2259f57fe3fa31
--- /dev/null
+++ b/components/browser_watcher/exit_funnel_win.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_BROWSER_WATCHER_END_SESSION_WIN_H_
erikwright (departed) 2014/12/12 16:58:29 fix this guard
Sigurður Ásgeirsson 2014/12/12 20:25:13 Done.
+#define COMPONENTS_BROWSER_WATCHER_END_SESSION_WIN_H_
+
+#include "base/process/process_handle.h"
+#include "base/strings/string16.h"
+#include "base/win/registry.h"
+
+namespace browser_watcher {
+
+// A wrapper class that takes care of persistently recording a trace of named,
+// timed events in registry, associated with a process instance. This allows
+// reconstructing and reporting an event trace on a subsequent launch.
+class ExitFunnel {
+ public:
+ ExitFunnel();
+ ~ExitFunnel();
+
+ // Initializes the exit funnel with |registry_path| and |process|.
+ // |process| must be open for PROCESS_QUERY_INFORMATION at least.
+ // Returns false on failure to create or open the registry path corresponding
+ // to |process|.
+ bool Init(const base::char16* registry_path, base::ProcessHandle process);
+
+ // Records |event_name| at the current time in the registry for the process
+ // this instance is associated with. Returns false on failure to record the
+ // event.
+ bool RecordEvent(const base::char16* event_name);
+
+ // Records |event_name| at the current time in the registry at |registry_path|
+ // for this process.
+ static bool RecordSingleEvent(const base::char16* registry_path,
+ const base::char16* event_name);
+
+ private:
+ base::win::RegKey key_;
+};
erikwright (departed) 2014/12/12 16:58:29 DISALLOW_...
Sigurður Ásgeirsson 2014/12/12 20:25:13 Ah - thanks.
+
+} // namespace browser_watcher
+
+#endif // COMPONENTS_BROWSER_WATCHER_END_SESSION_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698