OLD | NEW |
---|---|
(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 | |
12 namespace content { | |
13 struct BackgroundTracingConfig; | |
14 class BackgroundTracingUploadSink; | |
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( | |
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
| |
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, | |
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.
| |
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 virtual void InvalidateTriggerHandlesForTesting() = 0; | |
51 | |
52 protected: | |
53 virtual ~BackgroundTracingManager() {} | |
54 }; | |
55 | |
56 } // namespace content | |
57 | |
58 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ | |
OLD | NEW |