Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/trace_event/trace_event_impl.h" | 8 #include "base/trace_event/trace_event_impl.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // void Upload(const base::RefCountedString* data, | 32 // void Upload(const base::RefCountedString* data, |
| 33 // base::Closure done_callback) { | 33 // base::Closure done_callback) { |
| 34 // BrowserThread::PostTaskAndReply( | 34 // BrowserThread::PostTaskAndReply( |
| 35 // BrowserThread::FILE, | 35 // BrowserThread::FILE, |
| 36 // FROM_HERE, | 36 // FROM_HERE, |
| 37 // base::Bind(&DoUploadOnFileThread, data), | 37 // base::Bind(&DoUploadOnFileThread, data), |
| 38 // done_callback | 38 // done_callback |
| 39 // ); | 39 // ); |
| 40 // } | 40 // } |
| 41 // | 41 // |
| 42 typedef base::Callback<void(const base::RefCountedString*, base::Closure)> | 42 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&, |
|
shatch
2015/05/22 22:21:37
Intentional change?
| |
| 43 ReceiveCallback; | 43 base::Closure)> ReceiveCallback; |
| 44 | 44 |
| 45 // Set the triggering rules for when to start recording. | 45 // Set the triggering rules for when to start recording. |
| 46 // | 46 // |
| 47 // In preemptive mode, recording begins immediately and any calls to | 47 // In preemptive mode, recording begins immediately and any calls to |
| 48 // TriggerNamedEvent() will potentially trigger the trace to finalize and get | 48 // TriggerNamedEvent() will potentially trigger the trace to finalize and get |
| 49 // uploaded to the specified upload_sink. Once the trace has been uploaded, | 49 // uploaded to the specified upload_sink. Once the trace has been uploaded, |
| 50 // tracing will be enabled again. | 50 // tracing will be enabled again. |
| 51 // | 51 // |
| 52 // In reactive mode, recording begins when TriggerNamedEvent() is called, and | 52 // In reactive mode, recording begins when TriggerNamedEvent() is called, and |
| 53 // continues until either the next call to TriggerNamedEvent, or a timeout | 53 // continues until either the next call to TriggerNamedEvent, or a timeout |
| 54 // occurs. Tracing will not be re-enabled after the trace is finalized and | 54 // occurs. Tracing will not be re-enabled after the trace is finalized and |
| 55 // uploaded to the upload_sink. | 55 // uploaded to the upload_sink. |
| 56 // | 56 // |
| 57 // Calls to SetActiveScenario() with a config will fail if tracing is | 57 // Calls to SetActiveScenario() with a config will fail if tracing is |
| 58 // currently on. Use WhenIdle to register a callback to get notified when | 58 // currently on. Use WhenIdle to register a callback to get notified when |
| 59 // the manager is idle and a config can be set again. | 59 // the manager is idle and a config can be set again. |
| 60 virtual bool SetActiveScenario(scoped_ptr<BackgroundTracingConfig> config, | 60 virtual bool SetActiveScenario(scoped_ptr<BackgroundTracingConfig> config, |
| 61 const ReceiveCallback& receive_callback, | 61 const ReceiveCallback& receive_callback, |
| 62 const base::Closure& enabled_callback, | |
| 62 bool requires_anonymized_data) = 0; | 63 bool requires_anonymized_data) = 0; |
| 63 | 64 |
| 64 // Notifies the caller when the manager is idle (not recording or uploading), | 65 // Notifies the caller when the manager is idle (not recording or uploading), |
| 65 // so that a call to SetActiveScenario() is likely to succeed. | 66 // so that a call to SetActiveScenario() is likely to succeed. |
| 66 typedef base::Callback<void()> IdleCallback; | 67 typedef base::Callback<void()> IdleCallback; |
| 67 virtual void WhenIdle(IdleCallback idle_callback) = 0; | 68 virtual void WhenIdle(IdleCallback idle_callback) = 0; |
| 68 | 69 |
| 69 typedef base::Callback<void(bool)> StartedFinalizingCallback; | 70 typedef base::Callback<void(bool)> StartedFinalizingCallback; |
| 70 typedef int TriggerHandle; | 71 typedef int TriggerHandle; |
| 71 | 72 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 85 | 86 |
| 86 virtual void InvalidateTriggerHandlesForTesting() = 0; | 87 virtual void InvalidateTriggerHandlesForTesting() = 0; |
| 87 | 88 |
| 88 protected: | 89 protected: |
| 89 virtual ~BackgroundTracingManager() {} | 90 virtual ~BackgroundTracingManager() {} |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace content | 93 } // namespace content |
| 93 | 94 |
| 94 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ | 95 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_TRACING_MANAGER_H_ |
| OLD | NEW |