| Index: chrome/test/base/log_file_reader_win.h
|
| diff --git a/chrome/test/base/log_file_reader_win.h b/chrome/test/base/log_file_reader_win.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f24e3c276f9696433309b431eef0f20e555c0e59
|
| --- /dev/null
|
| +++ b/chrome/test/base/log_file_reader_win.h
|
| @@ -0,0 +1,77 @@
|
| +// 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.
|
| +
|
| +// A log file reader can read log files produced by Event Tracing for Windows
|
| +// (by way of the FileLogger class) that contain events generated from a select
|
| +// few supported providers; see file_logger_win.h for the list.
|
| +
|
| +#ifndef CHROME_TEST_BASE_LOG_FILE_READER_WIN_H_
|
| +#define CHROME_TEST_BASE_LOG_FILE_READER_WIN_H_
|
| +#pragma once
|
| +
|
| +#include <stddef.h>
|
| +#include <windows.h>
|
| +#include <wmistr.h>
|
| +#include <evntrace.h>
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/string_piece.h"
|
| +
|
| +class FilePath;
|
| +
|
| +namespace logging_win {
|
| +
|
| +// An interface to classes interested in taking action based on events parsed
|
| +// out of a log file created by the FileLogger.
|
| +class LogFileDelegate {
|
| + public:
|
| + virtual ~LogFileDelegate();
|
| +
|
| + // Invoked for event types not currently handled by the parser.
|
| + virtual void OnUnknownEvent(const EVENT_TRACE* event) = 0;
|
| +
|
| + // Invoked for events of known types that cannot be parsed due to unexpected
|
| + // data.
|
| + virtual void OnUnparsableEvent(const EVENT_TRACE* event) = 0;
|
| +
|
| + // Invoked for the header at the front of all log files.
|
| + virtual void OnFileHeader(const EVENT_TRACE* event,
|
| + const TRACE_LOGFILE_HEADER* header) = 0;
|
| +
|
| + // Invoked for simple log messages produced by LogEventProvider.
|
| + virtual void OnLogMessage(const EVENT_TRACE* event,
|
| + logging::LogSeverity severity,
|
| + const base::StringPiece& message) = 0;
|
| +
|
| + // Invoked for full log messages produced by LogEventProvider.
|
| + virtual void OnLogMessageFull(const EVENT_TRACE* event,
|
| + logging::LogSeverity severity,
|
| + DWORD stack_depth,
|
| + const intptr_t* backtrace,
|
| + int line,
|
| + const base::StringPiece& file,
|
| + const base::StringPiece& message) = 0;
|
| +
|
| + // Invoked for trace events produced by TraceEventETWProvider.
|
| + virtual void OnTraceEvent(const EVENT_TRACE* event,
|
| + const base::StringPiece& name,
|
| + char type,
|
| + intptr_t id,
|
| + const base::StringPiece& extra,
|
| + DWORD stack_depth,
|
| + const intptr_t* backtrace) = 0;
|
| +
|
| + protected:
|
| + LogFileDelegate();
|
| +};
|
| +
|
| +// Reads |log_file|, invoking appropriate methods on |delegate| as events are
|
| +// parsed. Although it is safe to call this from multiple threads, only one
|
| +// file may be read at a time; other threads trying to read other log files will
|
| +// be blocked waiting.
|
| +void ReadLogFile(const FilePath& log_file, LogFileDelegate* delegate);
|
| +
|
| +} // namespace logging_win
|
| +
|
| +#endif // CHROME_TEST_BASE_LOG_FILE_READER_WIN_H_
|
|
|