| 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 "chrome/test/chromedriver/performance_logger.h" | 5 #include "chrome/test/chromedriver/performance_logger.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (method == "Tracing.tracingComplete") { | 174 if (method == "Tracing.tracingComplete") { |
| 175 trace_buffering_ = false; | 175 trace_buffering_ = false; |
| 176 } else if (method == "Tracing.dataCollected") { | 176 } else if (method == "Tracing.dataCollected") { |
| 177 // The Tracing.dataCollected event contains a list of trace events. | 177 // The Tracing.dataCollected event contains a list of trace events. |
| 178 // Add each one as an individual log entry of method Tracing.dataCollected. | 178 // Add each one as an individual log entry of method Tracing.dataCollected. |
| 179 const base::ListValue* traces; | 179 const base::ListValue* traces; |
| 180 if (!params.GetList("value", &traces)) { | 180 if (!params.GetList("value", &traces)) { |
| 181 return Status(kUnknownError, | 181 return Status(kUnknownError, |
| 182 "received DevTools trace data in unexpected format"); | 182 "received DevTools trace data in unexpected format"); |
| 183 } | 183 } |
| 184 for (base::Value* const trace : *traces) { | 184 for (const auto& trace : *traces) { |
| 185 base::DictionaryValue* event_dict; | 185 base::DictionaryValue* event_dict; |
| 186 if (!trace->GetAsDictionary(&event_dict)) | 186 if (!trace->GetAsDictionary(&event_dict)) |
| 187 return Status(kUnknownError, "trace event must be a dictionary"); | 187 return Status(kUnknownError, "trace event must be a dictionary"); |
| 188 AddLogEntry(client->GetId(), "Tracing.dataCollected", *event_dict); | 188 AddLogEntry(client->GetId(), "Tracing.dataCollected", *event_dict); |
| 189 } | 189 } |
| 190 } else if (method == "Tracing.bufferUsage") { | 190 } else if (method == "Tracing.bufferUsage") { |
| 191 // 'value' will be between 0-1 and represents how full the DevTools trace | 191 // 'value' will be between 0-1 and represents how full the DevTools trace |
| 192 // buffer is. If the buffer is full, warn the user. | 192 // buffer is. If the buffer is full, warn the user. |
| 193 double buffer_usage = 0; | 193 double buffer_usage = 0; |
| 194 if (!params.GetDouble("value", &buffer_usage)) { | 194 if (!params.GetDouble("value", &buffer_usage)) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (status.IsError()) | 273 if (status.IsError()) |
| 274 return status; | 274 return status; |
| 275 | 275 |
| 276 return StartTrace(); | 276 return StartTrace(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 Status PerformanceLogger::IsTraceDone(bool* trace_done) const { | 279 Status PerformanceLogger::IsTraceDone(bool* trace_done) const { |
| 280 *trace_done = !trace_buffering_; | 280 *trace_done = !trace_buffering_; |
| 281 return Status(kOk); | 281 return Status(kOk); |
| 282 } | 282 } |
| OLD | NEW |