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 #include "extensions/browser/api/web_request/web_request_time_tracker.h" | 5 #include "extensions/browser/api/web_request/web_request_time_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "extensions/browser/warning_set.h" | 10 #include "extensions/browser/warning_set.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // that sets a warning in the extension service of |profile|. | 34 // that sets a warning in the extension service of |profile|. |
35 class DefaultDelegate : public ExtensionWebRequestTimeTrackerDelegate { | 35 class DefaultDelegate : public ExtensionWebRequestTimeTrackerDelegate { |
36 public: | 36 public: |
37 virtual ~DefaultDelegate() {} | 37 virtual ~DefaultDelegate() {} |
38 | 38 |
39 // Implementation of ExtensionWebRequestTimeTrackerDelegate. | 39 // Implementation of ExtensionWebRequestTimeTrackerDelegate. |
40 virtual void NotifyExcessiveDelays( | 40 virtual void NotifyExcessiveDelays( |
41 void* profile, | 41 void* profile, |
42 size_t num_delayed_messages, | 42 size_t num_delayed_messages, |
43 size_t total_num_messages, | 43 size_t total_num_messages, |
44 const std::set<std::string>& extension_ids) OVERRIDE; | 44 const std::set<std::string>& extension_ids) override; |
45 virtual void NotifyModerateDelays( | 45 virtual void NotifyModerateDelays( |
46 void* profile, | 46 void* profile, |
47 size_t num_delayed_messages, | 47 size_t num_delayed_messages, |
48 size_t total_num_messages, | 48 size_t total_num_messages, |
49 const std::set<std::string>& extension_ids) OVERRIDE; | 49 const std::set<std::string>& extension_ids) override; |
50 }; | 50 }; |
51 | 51 |
52 void DefaultDelegate::NotifyExcessiveDelays( | 52 void DefaultDelegate::NotifyExcessiveDelays( |
53 void* profile, | 53 void* profile, |
54 size_t num_delayed_messages, | 54 size_t num_delayed_messages, |
55 size_t total_num_messages, | 55 size_t total_num_messages, |
56 const std::set<std::string>& extension_ids) { | 56 const std::set<std::string>& extension_ids) { |
57 // TODO(battre) Enable warning the user if extensions misbehave as soon as we | 57 // TODO(battre) Enable warning the user if extensions misbehave as soon as we |
58 // have data that allows us to decide on reasonable limits for triggering the | 58 // have data that allows us to decide on reasonable limits for triggering the |
59 // warnings. | 59 // warnings. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // When a request is redirected, we have no way of knowing how long the | 240 // When a request is redirected, we have no way of knowing how long the |
241 // request would have taken, so we can't say how much an extension slowed | 241 // request would have taken, so we can't say how much an extension slowed |
242 // down this request. Just ignore it. | 242 // down this request. Just ignore it. |
243 request_time_logs_.erase(request_id); | 243 request_time_logs_.erase(request_id); |
244 } | 244 } |
245 | 245 |
246 void ExtensionWebRequestTimeTracker::SetDelegate( | 246 void ExtensionWebRequestTimeTracker::SetDelegate( |
247 ExtensionWebRequestTimeTrackerDelegate* delegate) { | 247 ExtensionWebRequestTimeTrackerDelegate* delegate) { |
248 delegate_.reset(delegate); | 248 delegate_.reset(delegate); |
249 } | 249 } |
OLD | NEW |