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

Unified Diff: content/browser/tracing/background_tracing_manager.h

Issue 1089253003: Re-land first pass BackgroundTracingManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More tests. Created 5 years, 8 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: content/browser/tracing/background_tracing_manager.h
diff --git a/content/browser/tracing/background_tracing_manager.h b/content/browser/tracing/background_tracing_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..1089d130f49ddd147709c44c19cc47f485e253c1
--- /dev/null
+++ b/content/browser/tracing/background_tracing_manager.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
oystein (OOO til 10th of July) 2015/04/21 17:31:44 nit: no (c)
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_H_
+#define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_H_
+
+#include "base/memory/ref_counted_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/trace_event/trace_event_impl.h"
+#include "content/browser/tracing/background_tracing_scenario.h"
+#include "content/common/content_export.h"
+
+template <typename T>
+struct DefaultSingletonTraits;
+
+namespace content {
+class BrowserContext;
+class TraceUploader;
+};
+
+namespace net {
+class URLRequestContextGetter;
+};
+
+class BackgroundTracingEndpoint;
+
+class BackgroundTracingManager {
+ public:
+ BackgroundTracingManager();
+ ~BackgroundTracingManager();
+
+ CONTENT_EXPORT static BackgroundTracingManager* GetInstance();
+
+ CONTENT_EXPORT void SetActiveScenario(
+ scoped_refptr<BackgroundTracingScenario>);
+
+ typedef base::Callback<void(bool)> StartedFinalizingCallback;
+
+ CONTENT_EXPORT void TryFinalizingBackgroundTracing(StartedFinalizingCallback);
+
+ bool is_gathering_for_testing() const { return is_gathering_; }
+ bool is_recording_for_testing() const { return is_recording_; }
+
+ private:
+ void EnableRecording();
+ void BeginFinalizingBackgroundTracing();
+ void OnFinalizeComplete();
+
+ scoped_refptr<BackgroundTracingScenario> active_scenario_;
+ bool is_gathering_;
+ bool is_recording_;
+
+ base::WeakPtrFactory<BackgroundTracingManager> weak_ptr_factory_;
+
+ friend struct DefaultSingletonTraits<BackgroundTracingManager>;
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManager);
+};
+
+#endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698