| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/tracing/etw_system_event_consumer_win.h" | 5 #include "content/browser/tracing/etw_system_event_consumer_win.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/debug/trace_event_impl.h" | 8 #include "base/debug/trace_event_impl.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 HRESULT hr = OpenRealtimeSession(KERNEL_LOGGER_NAME); | 188 HRESULT hr = OpenRealtimeSession(KERNEL_LOGGER_NAME); |
| 189 if (FAILED(hr)) | 189 if (FAILED(hr)) |
| 190 return; | 190 return; |
| 191 Consume(); | 191 Consume(); |
| 192 Close(); | 192 Close(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void EtwSystemEventConsumer::FlushOnThread(const OutputCallback& callback) { | 195 void EtwSystemEventConsumer::FlushOnThread(const OutputCallback& callback) { |
| 196 // Add the header information to the stream. | 196 // Add the header information to the stream. |
| 197 scoped_ptr<base::DictionaryValue> header(new base::DictionaryValue()); | 197 scoped_ptr<base::DictionaryValue> header(new base::DictionaryValue()); |
| 198 header->Set("name", base::Value::CreateStringValue("ETW")); | 198 header->Set("name", new base::StringValue("ETW")); |
| 199 | 199 |
| 200 // Release and pass the events buffer. | 200 // Release and pass the events buffer. |
| 201 header->Set("content", events_.release()); | 201 header->Set("content", events_.release()); |
| 202 | 202 |
| 203 // Serialize the results as a JSon string. | 203 // Serialize the results as a JSon string. |
| 204 std::string output; | 204 std::string output; |
| 205 JSONStringValueSerializer serializer(&output); | 205 JSONStringValueSerializer serializer(&output); |
| 206 serializer.Serialize(*header.get()); | 206 serializer.Serialize(*header.get()); |
| 207 | 207 |
| 208 // Pass the result to the UI Thread. | 208 // Pass the result to the UI Thread. |
| 209 scoped_refptr<base::RefCountedString> result = | 209 scoped_refptr<base::RefCountedString> result = |
| 210 base::RefCountedString::TakeString(&output); | 210 base::RefCountedString::TakeString(&output); |
| 211 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 211 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 212 base::Bind(callback, result)); | 212 base::Bind(callback, result)); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace content | 215 } // namespace content |
| OLD | NEW |