diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 19:21:33 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 19:21:33 +0000 |
commit | 50f3842eba03378f345cfe61364cda455b342be2 (patch) | |
tree | 870bb60805a45b6693240e7edda1a014932fc112 /content/browser/trace_controller.h | |
parent | 7979168e1dfbf9a61aa0adbf641b6d310191b8c4 (diff) | |
download | chromium_src-50f3842eba03378f345cfe61364cda455b342be2.zip chromium_src-50f3842eba03378f345cfe61364cda455b342be2.tar.gz chromium_src-50f3842eba03378f345cfe61364cda455b342be2.tar.bz2 |
Support --trace-startup and task tracing
passing --trace-startup puts the tracing system into record mode immediately saving the result to chrometrace.log or a file specified by --trace-startup-file
BUG=None
TEST=start chrome with --trace-startup, wait 5 secs, see chrometrace.log in current dir. open it in chrome://tracing/
Review URL: http://codereview.chromium.org/7887013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/trace_controller.h')
-rw-r--r-- | content/browser/trace_controller.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/content/browser/trace_controller.h b/content/browser/trace_controller.h index b14ec6a..1677056 100644 --- a/content/browser/trace_controller.h +++ b/content/browser/trace_controller.h @@ -13,6 +13,7 @@ #include "base/memory/singleton.h" #include "content/common/content_export.h" +class CommandLine; class TraceMessageFilter; // Objects interested in receiving trace data derive from TraceSubscriber. @@ -28,8 +29,11 @@ class CONTENT_EXPORT TraceSubscriber { virtual void OnTraceDataCollected(const std::string& trace_fragment) = 0; // Called once after TraceController::GetKnownCategoriesAsync. virtual void OnKnownCategoriesCollected( - const std::set<std::string>& known_categories) {} - virtual void OnTraceBufferPercentFullReply(float percent_full) {} + const std::set<std::string>& known_categories); + virtual void OnTraceBufferPercentFullReply(float percent_full); + + protected: + virtual ~TraceSubscriber(); }; // TraceController is used on the browser processes to enable/disable @@ -40,6 +44,10 @@ class CONTENT_EXPORT TraceController { public: static TraceController* GetInstance(); + // Called on the main thread of the browser process to initialize + // startup tracing. + void InitStartupTracing(const CommandLine& command_line); + // Get set of known categories. This can change as new code paths are reached. // If true is returned, subscriber->OnKnownCategoriesCollected will be called // when once the categories are retrieved from child processes. @@ -134,14 +142,16 @@ class CONTENT_EXPORT TraceController { pending_bpf_ack_count_ == 0; } - bool can_begin_tracing() const { return !is_tracing_; } + bool can_begin_tracing(TraceSubscriber* subscriber) const { + return !is_tracing_ && + (subscriber_ == NULL || subscriber == subscriber_); + } // Methods for use by TraceMessageFilter. - // Passing as scoped_refptr so that the method can be run asynchronously as - // a task safely (otherwise the TraceMessageFilter could be destructed). void AddFilter(TraceMessageFilter* filter); void RemoveFilter(TraceMessageFilter* filter); + void OnTracingBegan(TraceSubscriber* subscriber); void OnEndTracingAck(const std::vector<std::string>& known_categories); void OnTraceDataCollected( const scoped_refptr<base::debug::TraceLog::RefCountedString>& |