Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Unified Diff: chrome/browser/extensions/extension_webrequest_api.h

Issue 8176001: Warn user in case extension delays network traffic too much. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed Glen's comments Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_webrequest_api.h
diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h
index 268a4c27c89446cd13926371abfe20c3af902cc6..cf2f411d900f6d7d19d171876b72c1b293713c66 100644
--- a/chrome/browser/extensions/extension_webrequest_api.h
+++ b/chrome/browser/extensions/extension_webrequest_api.h
@@ -14,6 +14,7 @@
#include "base/memory/singleton.h"
#include "base/time.h"
#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/extension_webrequest_time_tracker.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/url_pattern_set.h"
#include "ipc/ipc_message.h"
@@ -22,7 +23,6 @@
#include "webkit/glue/resource_type.h"
class ExtensionInfoMap;
-class ExtensionWebRequestTimeTracker;
class GURL;
namespace base {
@@ -42,7 +42,8 @@ class URLRequest;
// This class observes network events and routes them to the appropriate
// extensions listening to those events. All methods must be called on the IO
// thread unless otherwise specified.
-class ExtensionWebRequestEventRouter {
+class ExtensionWebRequestEventRouter
+ : public ExtensionWebRequestTimeTrackerDelegate {
public:
enum EventTypes {
kInvalidEvent = 0,
@@ -271,7 +272,7 @@ class ExtensionWebRequestEventRouter {
typedef std::map<void*, void*> CrossProfileMap;
ExtensionWebRequestEventRouter();
- ~ExtensionWebRequestEventRouter();
+ virtual ~ExtensionWebRequestEventRouter();
bool DispatchEvent(
void* profile,
@@ -347,6 +348,18 @@ class ExtensionWebRequestEventRouter {
BlockedRequest* request,
std::list<std::string>* conflicting_extensions) const;
+ // Implementation for ExtensionWebRequestTimeTrackerDelegate:
+ virtual void NotifyExcessiveDelays(
+ void* profile,
+ size_t num_delayed_messages,
+ size_t total_num_messages,
+ const std::set<std::string>& extension_ids) OVERRIDE;
+ virtual void NotifyModerateDelays(
+ void* profile,
+ size_t num_delayed_messages,
+ size_t total_num_messages,
+ const std::set<std::string>& extension_ids) OVERRIDE;
+
// A map for each profile that maps an event name to a set of extensions that
// are listening to that event.
ListenerMap listeners_;

Powered by Google App Engine
This is Rietveld 408576698