| 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 #ifndef CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Creates a |PerformanceLogger| with default preferences that creates entries | 32 // Creates a |PerformanceLogger| with default preferences that creates entries |
| 33 // in the given Log object. The log is owned elsewhere and must not be null. | 33 // in the given Log object. The log is owned elsewhere and must not be null. |
| 34 PerformanceLogger(Log* log, const Session* session); | 34 PerformanceLogger(Log* log, const Session* session); |
| 35 | 35 |
| 36 // Creates a |PerformanceLogger| with specific preferences. | 36 // Creates a |PerformanceLogger| with specific preferences. |
| 37 PerformanceLogger(Log* log, | 37 PerformanceLogger(Log* log, |
| 38 const Session* session, | 38 const Session* session, |
| 39 const PerfLoggingPrefs& prefs); | 39 const PerfLoggingPrefs& prefs); |
| 40 | 40 |
| 41 // PerformanceLogger subscribes to browser-wide |DevToolsClient| for tracing. | 41 // PerformanceLogger subscribes to browser-wide |DevToolsClient| for tracing. |
| 42 virtual bool subscribes_to_browser() override; | 42 bool subscribes_to_browser() override; |
| 43 | 43 |
| 44 // For browser-wide client: enables tracing if trace categories are specified, | 44 // For browser-wide client: enables tracing if trace categories are specified, |
| 45 // sets |browser_client_|. For other clients: calls EnableInspectorDomains. | 45 // sets |browser_client_|. For other clients: calls EnableInspectorDomains. |
| 46 virtual Status OnConnected(DevToolsClient* client) override; | 46 Status OnConnected(DevToolsClient* client) override; |
| 47 | 47 |
| 48 // Calls HandleInspectorEvents or HandleTraceEvents depending on client type. | 48 // Calls HandleInspectorEvents or HandleTraceEvents depending on client type. |
| 49 virtual Status OnEvent(DevToolsClient* client, | 49 Status OnEvent(DevToolsClient* client, |
| 50 const std::string& method, | 50 const std::string& method, |
| 51 const base::DictionaryValue& params) override; | 51 const base::DictionaryValue& params) override; |
| 52 | 52 |
| 53 // Before whitelisted commands, if tracing enabled, calls CollectTraceEvents. | 53 // Before whitelisted commands, if tracing enabled, calls CollectTraceEvents. |
| 54 virtual Status BeforeCommand(const std::string& command_name) override; | 54 Status BeforeCommand(const std::string& command_name) override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 void AddLogEntry(Log::Level level, | 57 void AddLogEntry(Log::Level level, |
| 58 const std::string& webview, | 58 const std::string& webview, |
| 59 const std::string& method, | 59 const std::string& method, |
| 60 const base::DictionaryValue& params); | 60 const base::DictionaryValue& params); |
| 61 | 61 |
| 62 void AddLogEntry(const std::string& webview, | 62 void AddLogEntry(const std::string& webview, |
| 63 const std::string& method, | 63 const std::string& method, |
| 64 const base::DictionaryValue& params); | 64 const base::DictionaryValue& params); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 Log* log_; // The log where to create entries. | 84 Log* log_; // The log where to create entries. |
| 85 const Session* session_; | 85 const Session* session_; |
| 86 PerfLoggingPrefs prefs_; | 86 PerfLoggingPrefs prefs_; |
| 87 DevToolsClient* browser_client_; // Pointer to browser-wide |DevToolsClient|. | 87 DevToolsClient* browser_client_; // Pointer to browser-wide |DevToolsClient|. |
| 88 bool trace_buffering_; // True unless trace stopped and all events received. | 88 bool trace_buffering_; // True unless trace stopped and all events received. |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(PerformanceLogger); | 90 DISALLOW_COPY_AND_ASSIGN(PerformanceLogger); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 #endif // CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ | 93 #endif // CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ |
| OLD | NEW |