blob: 41fd017827f4996ddbab1372d618d8a21f01b453 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// 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_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_
#define CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_
#include <string>
#include <vector>
#include "base/debug/trace_event.h"
#include "content/public/browser/browser_message_filter.h"
namespace content {
// This class sends and receives trace messages on the browser process.
// See also: tracing_controller.h
// See also: child_trace_message_filter.h
class TraceMessageFilter : public BrowserMessageFilter {
public:
TraceMessageFilter();
// BrowserMessageFilter override.
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
// BrowserMessageFilter implementation.
virtual void OnChannelClosing() OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) OVERRIDE;
void SendBeginTracing(const std::string& category_filter_str,
base::debug::TraceLog::Options options);
void SendEndTracing();
void SendGetTraceBufferPercentFull();
void SendSetWatchEvent(const std::string& category_name,
const std::string& event_name);
void SendCancelWatchEvent();
protected:
virtual ~TraceMessageFilter();
private:
// Message handlers.
void OnChildSupportsTracing();
void OnEndTracingAck(const std::vector<std::string>& known_categories);
void OnTraceNotification(int notification);
void OnTraceBufferPercentFullReply(float percent_full);
void OnTraceDataCollected(const std::string& data);
// ChildTraceMessageFilter exists:
bool has_child_;
// Awaiting ack for previously sent SendEndTracing
bool is_awaiting_end_ack_;
// Awaiting ack for previously sent SendGetTraceBufferPercentFull
bool is_awaiting_buffer_percent_full_ack_;
DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter);
};
} // namespace content
#endif // CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_
|