Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: base/win/event_trace_consumer.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Declaration of a Windows event trace consumer base class. 5 // Declaration of a Windows event trace consumer base class.
6 #ifndef BASE_WIN_EVENT_TRACE_CONSUMER_H_ 6 #ifndef BASE_WIN_EVENT_TRACE_CONSUMER_H_
7 #define BASE_WIN_EVENT_TRACE_CONSUMER_H_ 7 #define BASE_WIN_EVENT_TRACE_CONSUMER_H_
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <wmistr.h> 10 #include <wmistr.h>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (reinterpret_cast<TRACEHANDLE>(INVALID_HANDLE_VALUE) == trace_handle) 112 if (reinterpret_cast<TRACEHANDLE>(INVALID_HANDLE_VALUE) == trace_handle)
113 return HRESULT_FROM_WIN32(::GetLastError()); 113 return HRESULT_FROM_WIN32(::GetLastError());
114 114
115 trace_handles_.push_back(trace_handle); 115 trace_handles_.push_back(trace_handle);
116 return S_OK; 116 return S_OK;
117 } 117 }
118 118
119 template <class ImplClass> inline 119 template <class ImplClass> inline
120 HRESULT EtwTraceConsumerBase<ImplClass>::Consume() { 120 HRESULT EtwTraceConsumerBase<ImplClass>::Consume() {
121 ULONG err = ::ProcessTrace(&trace_handles_[0], 121 ULONG err = ::ProcessTrace(&trace_handles_[0],
122 trace_handles_.size(), 122 static_cast<ULONG>(trace_handles_.size()),
123 NULL, 123 NULL,
124 NULL); 124 NULL);
125 return HRESULT_FROM_WIN32(err); 125 return HRESULT_FROM_WIN32(err);
126 } 126 }
127 127
128 template <class ImplClass> inline 128 template <class ImplClass> inline
129 HRESULT EtwTraceConsumerBase<ImplClass>::Close() { 129 HRESULT EtwTraceConsumerBase<ImplClass>::Close() {
130 HRESULT hr = S_OK; 130 HRESULT hr = S_OK;
131 for (size_t i = 0; i < trace_handles_.size(); ++i) { 131 for (size_t i = 0; i < trace_handles_.size(); ++i) {
132 if (NULL != trace_handles_[i]) { 132 if (NULL != trace_handles_[i]) {
133 ULONG ret = ::CloseTrace(trace_handles_[i]); 133 ULONG ret = ::CloseTrace(trace_handles_[i]);
134 trace_handles_[i] = NULL; 134 trace_handles_[i] = NULL;
135 135
136 if (FAILED(HRESULT_FROM_WIN32(ret))) 136 if (FAILED(HRESULT_FROM_WIN32(ret)))
137 hr = HRESULT_FROM_WIN32(ret); 137 hr = HRESULT_FROM_WIN32(ret);
138 } 138 }
139 } 139 }
140 trace_handles_.clear(); 140 trace_handles_.clear();
141 141
142 return hr; 142 return hr;
143 } 143 }
144 144
145 } // namespace win 145 } // namespace win
146 } // namespace base 146 } // namespace base
147 147
148 #endif // BASE_WIN_EVENT_TRACE_CONSUMER_H_ 148 #endif // BASE_WIN_EVENT_TRACE_CONSUMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698