| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void PerformanceLogger::AddLogEntry( | 116 void PerformanceLogger::AddLogEntry( |
| 117 Log::Level level, | 117 Log::Level level, |
| 118 const std::string& webview, | 118 const std::string& webview, |
| 119 const std::string& method, | 119 const std::string& method, |
| 120 const base::DictionaryValue& params) { | 120 const base::DictionaryValue& params) { |
| 121 base::DictionaryValue log_message_dict; | 121 base::DictionaryValue log_message_dict; |
| 122 log_message_dict.SetString("webview", webview); | 122 log_message_dict.SetString("webview", webview); |
| 123 log_message_dict.SetString("message.method", method); | 123 log_message_dict.SetString("message.method", method); |
| 124 log_message_dict.Set("message.params", params.DeepCopy()); | 124 log_message_dict.Set("message.params", params.DeepCopy()); |
| 125 std::string log_message_json; | 125 std::string log_message_json; |
| 126 base::JSONWriter::Write(&log_message_dict, &log_message_json); | 126 base::JSONWriter::Write(log_message_dict, &log_message_json); |
| 127 | 127 |
| 128 // TODO(klm): extract timestamp from params? | 128 // TODO(klm): extract timestamp from params? |
| 129 // Look at where it is for Page, Network, Timeline, and trace events. | 129 // Look at where it is for Page, Network, Timeline, and trace events. |
| 130 log_->AddEntry(level, log_message_json); | 130 log_->AddEntry(level, log_message_json); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void PerformanceLogger::AddLogEntry( | 133 void PerformanceLogger::AddLogEntry( |
| 134 const std::string& webview, | 134 const std::string& webview, |
| 135 const std::string& method, | 135 const std::string& method, |
| 136 const base::DictionaryValue& params) { | 136 const base::DictionaryValue& params) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (status.IsError()) | 279 if (status.IsError()) |
| 280 return status; | 280 return status; |
| 281 | 281 |
| 282 return StartTrace(); | 282 return StartTrace(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 Status PerformanceLogger::IsTraceDone(bool* trace_done) const { | 285 Status PerformanceLogger::IsTraceDone(bool* trace_done) const { |
| 286 *trace_done = !trace_buffering_; | 286 *trace_done = !trace_buffering_; |
| 287 return Status(kOk); | 287 return Status(kOk); |
| 288 } | 288 } |
| OLD | NEW |