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

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: Removed upload_sink. 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
12 namespace content {
13 struct BackgroundTracingConfig;
14 struct BackgroundTracingUploadConfig;
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 typedef base::Callback<void(base::RefCountedString*, base::Callback<void()>)>
no sievers 2015/05/20 19:22:39 const base::RefCountedString*?
no sievers 2015/05/20 19:22:39 nit: base::Callback<void()> -> base::Closure
no sievers 2015/05/20 19:22:40 Can you document what the arguments are? Esp. for
shatch 2015/05/20 19:53:55 Done.
shatch 2015/05/20 19:53:55 Done.
25 ReceiveCallback;
26
27 // Set the triggering rules for when to start recording.
28 //
29 // In preemptive mode, recording begins immediately and any calls to
30 // TriggerNamedEvent() will potentially trigger the trace to finalize and get
31 // uploaded to the specified upload_sink. Once the trace has been uploaded,
32 // tracing will be enabled again.
33 //
34 // In reactive mode, recording begins when TriggerNamedEvent() is called, and
35 // continues until either the next call to TriggerNamedEvent, or a timeout
36 // occurs. Tracing will not be re-enabled after the trace is finalized and
37 // uploaded to the upload_sink.
38 //
39 // Calls to SetActiveScenario() with a config will fail if tracing is
40 // currently on. Use WhenIdle to register a callback to get notified when
41 // the manager is idle and a config can be set again.
42 virtual bool SetActiveScenario(scoped_ptr<BackgroundTracingConfig> config,
43 const ReceiveCallback& receive_callback,
44 bool requires_anonymized_data) = 0;
45
46 // Notifies the caller when the manager is idle (not recording or uploading),
47 // so that a call to SetActiveScenario() is likely to succeed.
48 typedef base::Callback<void()> IdleCallback;
49 virtual void WhenIdle(IdleCallback idle_callback) = 0;
50
51 typedef base::Callback<void(bool)> StartedFinalizingCallback;
52 typedef int TriggerHandle;
53
54 // Notifies that a manual trigger event has occurred, and we may need to
55 // either begin recording or finalize the trace, depending on the config.
56 // If the trigger specified isn't active in the config, this will do nothing.
57 virtual void TriggerNamedEvent(
58 TriggerHandle,
no sievers 2015/05/20 19:22:39 nit: 'TriggerHandle trigger_handle' for consistenc
shatch 2015/05/20 19:53:55 Done.
59 StartedFinalizingCallback started_callback) = 0;
60
61 // Registers a manual trigger handle, and returns a TriggerHandle which can
62 // be passed to DidTriggerHappen().
63 virtual TriggerHandle RegisterTriggerType(const char* trigger_name) = 0;
64
65 // Returns a list of all registered triggers.
66 virtual void GetTriggerNameList(std::vector<std::string>& trigger_names) = 0;
no sievers 2015/05/20 19:22:39 nit: 'std::vector<std::string>*', by pointer when
shatch 2015/05/20 19:53:55 Done.
67
68 virtual void InvalidateTriggerHandlesForTesting() = 0;
69
70 protected:
71 virtual ~BackgroundTracingManager() {}
72 };
73
74 } // namespace content
75
76 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_
OLDNEW
« no previous file with comments | « content/public/browser/background_tracing_config.cc ('k') | content/public/browser/background_tracing_preemptive_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698