summaryrefslogtreecommitdiffstats
path: root/content/public/browser/trace_subscriber.h
blob: ec8d070ba4b8fc00e526aa0f5935972d0f05522d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_PUBLIC_BROWSER_TRACE_SUBSCRIBER_H_
#define CONTENT_PUBLIC_BROWSER_TRACE_SUBSCRIBER_H_

#include <set>

#include "base/memory/ref_counted_memory.h"

namespace content {

// Objects interested in receiving trace data derive from TraceSubscriber. All
// callbacks occur on the UI thread.
// See also: trace_message_filter.h
// See also: child_trace_message_filter.h
class TraceSubscriber {
 public:
  // Called once after TraceController::EndTracingAsync.
  virtual void OnEndTracingComplete() = 0;

  // Called 0 or more times between TraceController::BeginTracing and
  // OnEndTracingComplete. Use base::debug::TraceResultBuffer to convert one or
  // more trace fragments to JSON.
  virtual void OnTraceDataCollected(
      const scoped_refptr<base::RefCountedString>& trace_fragment) = 0;

  // Called once after TraceController::GetKnownCategoriesAsync.
  virtual void OnKnownCategoriesCollected(
      const std::set<std::string>& known_categories) {}

  virtual void OnTraceBufferPercentFullReply(float percent_full) {}

  virtual void OnEventWatchNotification() {}

 protected:
  virtual ~TraceSubscriber() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_TRACE_SUBSCRIBER_H_