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

Unified Diff: content/browser/tracing/tracing_controller_impl.h

Issue 66893003: Allow TracingController to output trace data to specified file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary include Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/tracing/tracing_controller_impl.h
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h
index 175365e6d3e910c3350d6e98cf70e0cc94be73fb..cbc05aa4294e75911e3e8c5bef6668b6c30c17d0 100644
--- a/content/browser/tracing/tracing_controller_impl.h
+++ b/content/browser/tracing/tracing_controller_impl.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "content/public/browser/trace_subscriber.h"
#include "content/public/browser/tracing_controller.h"
@@ -17,8 +18,7 @@ namespace content {
class TraceMessageFilter;
-class TracingControllerImpl :
- public TracingController, public TraceSubscriber {
+class TracingControllerImpl : public TracingController {
public:
static TracingControllerImpl* GetInstance();
@@ -30,6 +30,7 @@ class TracingControllerImpl :
TracingController::Options options,
const EnableRecordingDoneCallback& callback) OVERRIDE;
virtual bool DisableRecording(
+ const base::FilePath& result_file_path,
const TracingFileResultCallback& callback) OVERRIDE;
virtual bool EnableMonitoring(const base::debug::CategoryFilter& filter,
TracingController::Options options,
@@ -41,10 +42,12 @@ class TracingControllerImpl :
base::debug::CategoryFilter* out_filter,
TracingController::Options* out_options) OVERRIDE;
virtual void CaptureMonitoringSnapshot(
+ const base::FilePath& result_file_path,
const TracingFileResultCallback& callback) OVERRIDE;
private:
typedef std::set<scoped_refptr<TraceMessageFilter> > FilterMap;
+ class ResultFile;
friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>;
friend class TraceMessageFilter;
@@ -52,16 +55,12 @@ class TracingControllerImpl :
TracingControllerImpl();
virtual ~TracingControllerImpl();
- // TraceSubscriber implementation.
- virtual void OnTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str_ptr) OVERRIDE;
-
bool can_enable_recording() const {
return !is_recording_;
}
bool can_disable_recording() const {
- return is_recording_ && pending_disable_recording_ack_count_ == 0;
+ return is_recording_ && !result_file_;
}
bool can_enable_monitoring() const {
@@ -69,14 +68,18 @@ class TracingControllerImpl :
}
bool can_disable_monitoring() const {
- return is_monitoring_ &&
- pending_capture_monitoring_snapshot_ack_count_ == 0;
+ return is_monitoring_ && !monitoring_snapshot_file_;
}
// Methods for use by TraceMessageFilter.
void AddFilter(TraceMessageFilter* filter);
void RemoveFilter(TraceMessageFilter* filter);
+ void OnTraceDataCollected(
+ const scoped_refptr<base::RefCountedString>& events_str_ptr);
+ void OnMonitoringTraceDataCollected(
+ const scoped_refptr<base::RefCountedString>& events_str_ptr);
+
// Callback of TraceLog::Flush() for the local trace.
void OnLocalTraceDataCollected(
const scoped_refptr<base::RefCountedString>& events_str_ptr,
@@ -88,7 +91,10 @@ class TracingControllerImpl :
void OnDisableRecordingAcked(
const std::vector<std::string>& known_category_groups);
+ void OnResultFileClosed();
+
void OnCaptureMonitoringSnapshotAcked();
+ void OnMonitoringSnapshotFileClosed();
FilterMap filters_;
// Pending acks for DisableRecording.
@@ -103,10 +109,8 @@ class TracingControllerImpl :
std::set<std::string> known_category_groups_;
base::debug::TraceLog::Options trace_options_;
base::debug::CategoryFilter category_filter_;
- FILE* result_file_;
- scoped_ptr<base::FilePath> result_file_path_;
- bool result_file_has_at_least_one_result_;
-
+ scoped_ptr<ResultFile> result_file_;
+ scoped_ptr<ResultFile> monitoring_snapshot_file_;
DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
};
« no previous file with comments | « content/browser/tracing/tracing_controller_browsertest.cc ('k') | content/browser/tracing/tracing_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698