Index: content/public/browser/background_tracing_manager.h |
diff --git a/content/public/browser/background_tracing_manager.h b/content/public/browser/background_tracing_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2bc86bd386ab9faf50cfe9a187977bcc30c17ad3 |
--- /dev/null |
+++ b/content/public/browser/background_tracing_manager.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2015 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 CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |
+#define CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |
+ |
+#include "base/trace_event/trace_event_impl.h" |
+#include "base/values.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+struct BackgroundTracingConfig; |
+class BackgroundTracingUploadSink; |
+ |
+// BackgroundTracingManager is used on the browser process to trigger the |
+// collection of trace data and upload the results. Only the browser UI thread |
+// is allowed to interact with the BackgroundTracingManager. All callbacks are |
+// called on the UI thread. |
+class BackgroundTracingManager { |
+ public: |
+ CONTENT_EXPORT static BackgroundTracingManager* GetInstance(); |
+ |
+ // Set the triggering rules for when to start recording. |
+ virtual bool SetActiveScenario( |
no sievers
2015/05/14 21:25:16
Question: Do you think it would ever be useful to
shatch
2015/05/15 21:00:51
Hmm I'm not sure how easy or useful it would be to
|
+ scoped_refptr<BackgroundTracingConfig> config, |
+ scoped_refptr<BackgroundTracingUploadSink> upload_sink) = 0; |
+ |
+ // Notifies the caller when the manager is idle (not recording or uploading), |
+ // so that a call to SetActiveScenario() is likely to succeed. |
+ typedef base::Callback<void()> IdleCallback; |
+ virtual void WhenIdle(IdleCallback idle_callback) = 0; |
+ |
+ typedef base::Callback<void(bool)> StartedFinalizingCallback; |
+ typedef int TriggerHandle; |
+ |
+ // Notifies that a manual trigger event has occurred, and we may need to |
+ // either begin recording or finalize the trace, depending on the config. |
+ // If the trigger specified isn't active in the config, this will do nothing. |
+ virtual void DidTriggerHappen(TriggerHandle, |
no sievers
2015/05/14 21:25:16
nit: Maybe avoid the 'Did' prefix here. You are re
shatch
2015/05/15 21:00:51
Done.
|
+ StartedFinalizingCallback started_callback) = 0; |
+ |
+ // Registers a manual trigger handle, and returns a TriggerHandle which can |
+ // be passed to DidTriggerHappen(). |
+ virtual TriggerHandle RegisterTriggerType(const char* trigger_name) = 0; |
+ |
+ // Returns a list of all registered triggers. |
+ virtual void GetTriggerNameList(std::vector<std::string>& trigger_names) = 0; |
+ |
+ virtual void InvalidateTriggerHandlesForTesting() = 0; |
+ |
+ protected: |
+ virtual ~BackgroundTracingManager() {} |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |