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

Side by Side Diff: content/public/browser/background_tracing_manager.h

Issue 1089253003: Re-land first pass BackgroundTracingManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split into multiple files in content/public/browser. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_
6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_
7
8 #include "base/trace_event/trace_event_impl.h"
9 #include "base/values.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/background_tracing_config.h"
no sievers 2015/05/11 21:13:27 nit: I think you can fwd-declare some of these
shatch 2015/05/12 21:00:05 Done.
12 #include "content/public/browser/background_tracing_upload_sink.h"
13
14 namespace content {
15
16 // BackgroundTracingManager is used on the browser process to trigger the
17 // collection of trace data and upload the results. Only the browser UI thread
18 // is allowed to interact with the BackgroundTracingManager. All callbacks are
19 // called on the UI thread.
20 class BackgroundTracingManager {
21 public:
22 CONTENT_EXPORT static BackgroundTracingManager* GetInstance();
23
24 // Set the triggering rules for when to start recording.
25 virtual bool SetActiveScenario(
26 scoped_refptr<BackgroundTracingConfig> config,
27 scoped_refptr<BackgroundTracingUploadSink> upload_sink) = 0;
28
29 // Notifies the caller when the manager is idle (not recording or uploading),
30 // so that a call to SetActiveScenario() is likely to succeed.
31 typedef base::Callback<void()> IdleCallback;
32 virtual void WhenIdle(IdleCallback idle_callback) = 0;
33
34 typedef base::Callback<void(bool)> StartedFinalizingCallback;
35 typedef int TriggerHandle;
36
37 // Notifies that a manual trigger event has occurred, and we may need to
38 // either begin recording or finalize the trace, depending on the config.
39 // If the trigger specified isn't active in the config, this will do nothing.
40 virtual void DidTriggerHappen(TriggerHandle,
41 StartedFinalizingCallback started_callback) = 0;
42
43 // Registers a manual trigger handle, and returns a TriggerHandle which can
44 // be passed to DidTriggerHappen().
45 virtual TriggerHandle RegisterTriggerType(const char* trigger_name) = 0;
46
47 // Returns a list of all registered triggers.
48 virtual void GetTriggerNameList(std::vector<std::string>& trigger_names) = 0;
49
50 protected:
51 virtual ~BackgroundTracingManager() {}
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698