| OLD | NEW |
| 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 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
| 12 #include <queue> | 13 #include <queue> |
| 13 #include <set> | 14 #include <set> |
| 14 #include <string> | 15 #include <string> |
| 15 | 16 |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class Time; | 23 class Time; |
| 24 } | 24 } |
| 25 | 25 |
| 26 class ExtensionWebRequestTimeTrackerDelegate { | 26 class ExtensionWebRequestTimeTrackerDelegate { |
| 27 public: | 27 public: |
| 28 virtual ~ExtensionWebRequestTimeTrackerDelegate() {} | 28 virtual ~ExtensionWebRequestTimeTrackerDelegate() {} |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // A list of recent request IDs that we know about. Used to limit the size of | 108 // A list of recent request IDs that we know about. Used to limit the size of |
| 109 // the logs. | 109 // the logs. |
| 110 std::queue<int64_t> request_ids_; | 110 std::queue<int64_t> request_ids_; |
| 111 | 111 |
| 112 // The set of recent requests that have been delayed either a large or | 112 // The set of recent requests that have been delayed either a large or |
| 113 // moderate amount by extensions. | 113 // moderate amount by extensions. |
| 114 std::set<int64_t> excessive_delays_; | 114 std::set<int64_t> excessive_delays_; |
| 115 std::set<int64_t> moderate_delays_; | 115 std::set<int64_t> moderate_delays_; |
| 116 | 116 |
| 117 // Defaults to a delegate that sets warnings in the extension service. | 117 // Defaults to a delegate that sets warnings in the extension service. |
| 118 scoped_ptr<ExtensionWebRequestTimeTrackerDelegate> delegate_; | 118 std::unique_ptr<ExtensionWebRequestTimeTrackerDelegate> delegate_; |
| 119 | 119 |
| 120 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, Basic); | 120 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, Basic); |
| 121 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, | 121 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, |
| 122 IgnoreFastRequests); | 122 IgnoreFastRequests); |
| 123 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, | 123 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, |
| 124 CancelOrRedirect); | 124 CancelOrRedirect); |
| 125 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, Delays); | 125 FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, Delays); |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestTimeTracker); | 127 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestTimeTracker); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ | 130 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_TIME_TRACKER_H_ |
| OLD | NEW |