summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorsiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-06 15:39:40 +0000
committersiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-06 15:39:40 +0000
commitba50d192694e3bbdd99d153205e7fcef236abf8a (patch)
treed4621c1cbad3e63cd87c40689c0ae5daaafab1fe /base
parentf2505c82c17948056214d3437d53620610fba837 (diff)
downloadchromium_src-ba50d192694e3bbdd99d153205e7fcef236abf8a.zip
chromium_src-ba50d192694e3bbdd99d153205e7fcef236abf8a.tar.gz
chromium_src-ba50d192694e3bbdd99d153205e7fcef236abf8a.tar.bz2
Move Windows-specific Event Tracing for Windows implementation to base/win.
fix users of same. BUG=none TEST=unittests Review URL: http://codereview.chromium.org/4517004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gyp9
-rw-r--r--base/base.gypi10
-rw-r--r--base/debug/trace_event_win.cc3
-rw-r--r--base/debug/trace_event_win.h10
-rw-r--r--base/debug/trace_event_win_unittest.cc9
-rw-r--r--base/logging_win.cc3
-rw-r--r--base/logging_win.h4
-rw-r--r--base/win/event_trace_consumer.h (renamed from base/event_trace_consumer_win.h)12
-rw-r--r--base/win/event_trace_consumer_unittest.cc (renamed from base/event_trace_consumer_win_unittest.cc)12
-rw-r--r--base/win/event_trace_controller.cc (renamed from base/event_trace_controller_win.cc)8
-rw-r--r--base/win/event_trace_controller.h (renamed from base/event_trace_controller_win.h)12
-rw-r--r--base/win/event_trace_controller_unittest.cc (renamed from base/event_trace_controller_win_unittest.cc)8
-rw-r--r--base/win/event_trace_provider.cc (renamed from base/event_trace_provider_win.cc)8
-rw-r--r--base/win/event_trace_provider.h (renamed from base/event_trace_provider_win.h)12
-rw-r--r--base/win/event_trace_provider_unittest.cc (renamed from base/event_trace_provider_win_unittest.cc)5
15 files changed, 88 insertions, 37 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 6a37f5d..6ae1a95 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -80,9 +80,6 @@
'debug/trace_event_win_unittest.cc',
'dir_reader_posix_unittest.cc',
'environment_unittest.cc',
- 'event_trace_consumer_win_unittest.cc',
- 'event_trace_controller_win_unittest.cc',
- 'event_trace_provider_win_unittest.cc',
'file_descriptor_shuffle_unittest.cc',
'file_path_unittest.cc',
'file_util_unittest.cc',
@@ -163,6 +160,9 @@
'watchdog_unittest.cc',
'weak_ptr_unittest.cc',
'win_util_unittest.cc',
+ 'win/event_trace_consumer_unittest.cc',
+ 'win/event_trace_controller_unittest.cc',
+ 'win/event_trace_provider_unittest.cc',
'win/pe_image_unittest.cc',
'win/registry_unittest.cc',
'win/scoped_bstr_unittest.cc',
@@ -225,9 +225,6 @@
['exclude', '^win/'],
],
'sources!': [
- 'event_trace_consumer_win_unittest.cc',
- 'event_trace_controller_win_unittest.cc',
- 'event_trace_provider_win_unittest.cc',
'object_watcher_unittest.cc',
'system_monitor_unittest.cc',
'time_win_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index abad639..fb4732c 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -76,11 +76,6 @@
'dir_reader_posix.h',
'environment.cc',
'environment.h',
- 'event_trace_consumer_win.h',
- 'event_trace_controller_win.cc',
- 'event_trace_controller_win.h',
- 'event_trace_provider_win.cc',
- 'event_trace_provider_win.h',
'file_path.cc',
'file_path.h',
'file_util.cc',
@@ -297,6 +292,11 @@
'weak_ptr.cc',
'weak_ptr.h',
'win/pe_image.cc',
+ 'win/event_trace_consumer.h',
+ 'win/event_trace_controller.cc',
+ 'win/event_trace_controller.h',
+ 'win/event_trace_provider.cc',
+ 'win/event_trace_provider.h',
'win/pe_image.h',
'win/registry.cc',
'win/registry.h',
diff --git a/base/debug/trace_event_win.cc b/base/debug/trace_event_win.cc
index 129a992..8405699 100644
--- a/base/debug/trace_event_win.cc
+++ b/base/debug/trace_event_win.cc
@@ -11,6 +11,9 @@
namespace base {
namespace debug {
+using base::win::EtwEventType;
+using base::win::EtwMofEvent;
+
// {3DADA31D-19EF-4dc1-B345-037927193422}
const GUID kChromeTraceProviderName = {
0x3dada31d, 0x19ef, 0x4dc1, 0xb3, 0x45, 0x3, 0x79, 0x27, 0x19, 0x34, 0x22 };
diff --git a/base/debug/trace_event_win.h b/base/debug/trace_event_win.h
index 669667b..dd3f512 100644
--- a/base/debug/trace_event_win.h
+++ b/base/debug/trace_event_win.h
@@ -8,7 +8,7 @@
#pragma once
#include <string>
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_provider.h"
#define TRACE_EVENT_BEGIN(name, id, extra) \
base::debug::TraceLog::Trace( \
@@ -40,7 +40,7 @@ namespace debug {
// This EtwTraceProvider subclass implements ETW logging
// for the macros above on Windows.
-class TraceLog : public EtwTraceProvider {
+class TraceLog : public base::win::EtwTraceProvider {
public:
enum EventType {
EVENT_BEGIN,
@@ -126,9 +126,9 @@ extern const GUID kTraceEventClass32;
extern const GUID kTraceEventClass64;
// The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10.
-const EtwEventType kTraceEventTypeBegin = 0x10;
-const EtwEventType kTraceEventTypeEnd = 0x11;
-const EtwEventType kTraceEventTypeInstant = 0x12;
+const base::win::EtwEventType kTraceEventTypeBegin = 0x10;
+const base::win::EtwEventType kTraceEventTypeEnd = 0x11;
+const base::win::EtwEventType kTraceEventTypeInstant = 0x12;
// If this flag is set in enable flags
enum TraceEventFlags {
diff --git a/base/debug/trace_event_win_unittest.cc b/base/debug/trace_event_win_unittest.cc
index a818b9b..8544bc7 100644
--- a/base/debug/trace_event_win_unittest.cc
+++ b/base/debug/trace_event_win_unittest.cc
@@ -9,8 +9,8 @@
#include "base/at_exit.h"
#include "base/basictypes.h"
#include "base/file_util.h"
-#include "base/event_trace_consumer_win.h"
-#include "base/event_trace_controller_win.h"
+#include "base/win/event_trace_consumer.h"
+#include "base/win/event_trace_controller.h"
#include "base/win/windows_version.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -28,6 +28,11 @@ using testing::Ge;
using testing::Le;
using testing::NotNull;
+using base::win::EtwEventType;
+using base::win::EtwTraceConsumerBase;
+using base::win::EtwTraceController;
+using base::win::EtwTraceProperties;
+
// Data for unittests traces.
const char kEmpty[] = "";
const char kName[] = "unittest.trace_name";
diff --git a/base/logging_win.cc b/base/logging_win.cc
index 588e4d9..42610b5 100644
--- a/base/logging_win.cc
+++ b/base/logging_win.cc
@@ -16,6 +16,9 @@ Singleton<logging::LogEventProvider, LogEventSingletonTraits> log_provider;
namespace logging {
+using base::win::EtwEventLevel;
+using base::win::EtwMofEvent;
+
DEFINE_GUID(kLogEventId,
0x7fe69228, 0x633e, 0x4f06, 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7);
diff --git a/base/logging_win.h b/base/logging_win.h
index 74f0da0..695c7f2 100644
--- a/base/logging_win.h
+++ b/base/logging_win.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_provider.h"
#include "base/logging.h"
namespace logging {
@@ -45,7 +45,7 @@ enum LogMessageTypes {
// Trace provider class to drive log control and transport
// with Event Tracing for Windows.
-class LogEventProvider : public EtwTraceProvider {
+class LogEventProvider : public base::win::EtwTraceProvider {
public:
LogEventProvider();
diff --git a/base/event_trace_consumer_win.h b/base/win/event_trace_consumer.h
index de53ab2..1ceb9ee 100644
--- a/base/event_trace_consumer_win.h
+++ b/base/win/event_trace_consumer.h
@@ -3,8 +3,8 @@
// found in the LICENSE file.
//
// Declaration of a Windows event trace consumer base class.
-#ifndef BASE_EVENT_TRACE_CONSUMER_WIN_H_
-#define BASE_EVENT_TRACE_CONSUMER_WIN_H_
+#ifndef BASE_WIN_EVENT_TRACE_CONSUMER_H_
+#define BASE_WIN_EVENT_TRACE_CONSUMER_H_
#pragma once
#include <windows.h>
@@ -13,6 +13,9 @@
#include <vector>
#include "base/basictypes.h"
+namespace base {
+namespace win {
+
// This class is a base class that makes it easier to consume events
// from realtime or file sessions. Concrete consumers need to sublass
// a specialization of this class and override the ProcessEvent and/or
@@ -141,4 +144,7 @@ HRESULT EtwTraceConsumerBase<ImplClass>::Close() {
return hr;
}
-#endif // BASE_EVENT_TRACE_CONSUMER_WIN_H_
+} // namespace win
+} // namespace base
+
+#endif // BASE_WIN_EVENT_TRACE_CONSUMER_H_
diff --git a/base/event_trace_consumer_win_unittest.cc b/base/win/event_trace_consumer_unittest.cc
index 412ca0c..f11f459 100644
--- a/base/event_trace_consumer_win_unittest.cc
+++ b/base/win/event_trace_consumer_unittest.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
//
// Unit tests for event trace consumer_ base class.
-#include "base/event_trace_consumer_win.h"
+#include "base/win/event_trace_consumer.h"
#include <list>
#include "base/basictypes.h"
-#include "base/event_trace_controller_win.h"
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -18,6 +18,12 @@
namespace {
+using base::win::EtwMofEvent;
+using base::win::EtwTraceController;
+using base::win::EtwTraceConsumerBase;
+using base::win::EtwTraceProperties;
+using base::win::EtwTraceProvider;
+
typedef std::list<EVENT_TRACE> EventQueue;
class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
diff --git a/base/event_trace_controller_win.cc b/base/win/event_trace_controller.cc
index 0e11d8a..0391fbc 100644
--- a/base/event_trace_controller_win.cc
+++ b/base/win/event_trace_controller.cc
@@ -3,9 +3,12 @@
// found in the LICENSE file.
//
// Implementation of a Windows event trace controller class.
-#include "base/event_trace_controller_win.h"
+#include "base/win/event_trace_controller.h"
#include "base/logging.h"
+namespace base {
+namespace win {
+
EtwTraceProperties::EtwTraceProperties() {
memset(buffer_, 0, sizeof(buffer_));
EVENT_TRACE_PROPERTIES* prop = get();
@@ -165,3 +168,6 @@ HRESULT EtwTraceController::Flush(const wchar_t* session_name,
EVENT_TRACE_CONTROL_FLUSH);
return HRESULT_FROM_WIN32(err);
}
+
+} // namespace win
+} // namespace base
diff --git a/base/event_trace_controller_win.h b/base/win/event_trace_controller.h
index bf44fa9..8eb172ed 100644
--- a/base/event_trace_controller_win.h
+++ b/base/win/event_trace_controller.h
@@ -17,8 +17,8 @@
//
// A trace consumer consumes events from zero or one realtime session,
// as well as potentially from multiple binary trace files.
-#ifndef BASE_EVENT_TRACE_CONTROLLER_WIN_H_
-#define BASE_EVENT_TRACE_CONTROLLER_WIN_H_
+#ifndef BASE_WIN_EVENT_TRACE_CONTROLLER_H_
+#define BASE_WIN_EVENT_TRACE_CONTROLLER_H_
#pragma once
#include <windows.h>
@@ -27,6 +27,9 @@
#include <string>
#include "base/basictypes.h"
+namespace base {
+namespace win {
+
// Utility class to make it easier to work with EVENT_TRACE_PROPERTIES.
// The EVENT_TRACE_PROPERTIES structure contains information about an
// event tracing session.
@@ -141,4 +144,7 @@ class EtwTraceController {
DISALLOW_COPY_AND_ASSIGN(EtwTraceController);
};
-#endif // BASE_EVENT_TRACE_CONTROLLER_WIN_H_
+} // namespace win
+} // namespace base
+
+#endif // BASE_WIN_EVENT_TRACE_CONTROLLER_H_
diff --git a/base/event_trace_controller_win_unittest.cc b/base/win/event_trace_controller_unittest.cc
index 1fcb616..2b3cd66 100644
--- a/base/event_trace_controller_win_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
//
// Unit tests for event trace controller.
-#include "base/event_trace_controller_win.h"
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -15,6 +15,10 @@
namespace {
+using base::win::EtwTraceController;
+using base::win::EtwTraceProvider;
+using base::win::EtwTraceProperties;
+
const wchar_t kTestSessionName[] = L"TestLogSession";
// {0D236A42-CD18-4e3d-9975-DCEEA2106E05}
diff --git a/base/event_trace_provider_win.cc b/base/win/event_trace_provider.cc
index 826a4bf..332fac3 100644
--- a/base/event_trace_provider_win.cc
+++ b/base/win/event_trace_provider.cc
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_provider.h"
#include <windows.h>
#include <cguid.h>
+namespace base {
+namespace win {
+
TRACE_GUID_REGISTRATION EtwTraceProvider::obligatory_guid_registration_ = {
&GUID_NULL,
NULL
@@ -126,3 +129,6 @@ ULONG EtwTraceProvider::Log(EVENT_TRACE_HEADER* event) {
return ::TraceEvent(session_handle_, event);
}
+
+} // namespace win
+} // namespace base
diff --git a/base/event_trace_provider_win.h b/base/win/event_trace_provider.h
index 5c89d1a..6614c91 100644
--- a/base/event_trace_provider_win.h
+++ b/base/win/event_trace_provider.h
@@ -4,8 +4,8 @@
//
// Declaration of a Windows event trace provider class, to allow using
// Windows Event Tracing for logging transport and control.
-#ifndef BASE_EVENT_TRACE_PROVIDER_WIN_H_
-#define BASE_EVENT_TRACE_PROVIDER_WIN_H_
+#ifndef BASE_WIN_EVENT_TRACE_PROVIDER_H_
+#define BASE_WIN_EVENT_TRACE_PROVIDER_H_
#pragma once
#include <windows.h>
@@ -13,6 +13,9 @@
#include <evntrace.h>
#include "base/basictypes.h"
+namespace base {
+namespace win {
+
typedef GUID EtwEventClass;
typedef UCHAR EtwEventType;
typedef UCHAR EtwEventLevel;
@@ -165,4 +168,7 @@ class EtwTraceProvider {
DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider);
};
-#endif // BASE_EVENT_TRACE_PROVIDER_WIN_H_
+} // namespace win
+} // namespace base
+
+#endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_
diff --git a/base/event_trace_provider_win_unittest.cc b/base/win/event_trace_provider_unittest.cc
index 1efa74f..55b5ae6 100644
--- a/base/event_trace_provider_win_unittest.cc
+++ b/base/win/event_trace_provider_unittest.cc
@@ -3,13 +3,16 @@
// found in the LICENSE file.
//
// Unit tests for event trace provider.
-#include "base/event_trace_provider_win.h"
+#include "base/win/event_trace_provider.h"
#include <new>
#include "testing/gtest/include/gtest/gtest.h"
#include <initguid.h> // NOLINT - has to be last
namespace {
+using base::win::EtwTraceProvider;
+using base::win::EtwMofEvent;
+
// {7F0FD37F-FA3C-4cd6-9242-DF60967A2CB2}
DEFINE_GUID(kTestProvider,
0x7f0fd37f, 0xfa3c, 0x4cd6, 0x92, 0x42, 0xdf, 0x60, 0x96, 0x7a, 0x2c, 0xb2);