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

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

Issue 460108: Implement ResourceQueue, an object that makes it easy to delay starting (Closed)
Patch Set: nitfixing Created 11 years 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
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_listener.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_listener.h
diff --git a/chrome/browser/extensions/user_script_listener.h b/chrome/browser/extensions/user_script_listener.h
index 105af4d279059b82a4a7d3e1aff76fd38a1a996f..f24bd05ccccd5ec4957325e7d85e2a7f0b885682 100644
--- a/chrome/browser/extensions/user_script_listener.h
+++ b/chrome/browser/extensions/user_script_listener.h
@@ -8,12 +8,13 @@
#include <list>
#include "base/ref_counted.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
+#include "chrome/browser/renderer_host/resource_queue.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/notification_registrar.h"
class Extension;
class URLRequest;
+struct GlobalRequestID;
// This class handles delaying of resource loads that depend on unloaded user
// scripts. For each request that comes in, we check if it depends on a user
@@ -24,16 +25,17 @@ class URLRequest;
// updates to loaded extensions.
class UserScriptListener
: public base::RefCountedThreadSafe<UserScriptListener>,
+ public ResourceQueueDelegate,
public NotificationObserver {
public:
- explicit UserScriptListener(ResourceDispatcherHost* rdh);
+ explicit UserScriptListener(ResourceQueue* resource_queue);
- void OnResourceDispatcherHostGone() { resource_dispatcher_host_ = NULL; }
-
- // Returns true if we're ready to service the request. Otherwise, if the
- // request URL depends on any user scripts that haven't been loaded yet, we
- // will delay the request until we're ready.
- bool ShouldStartRequest(URLRequest* request);
+ // ResourceQueueDelegate:
+ virtual bool ShouldDelayRequest(
+ URLRequest* request,
+ const ResourceDispatcherHostRequestInfo& request_info,
+ const GlobalRequestID& request_id);
+ virtual void WillShutdownResourceQueue();
private:
friend class base::RefCountedThreadSafe<UserScriptListener>;
@@ -53,11 +55,11 @@ class UserScriptListener
// deleted, so user_scripts_ready_ remains unchanged.
void ReplaceURLPatterns(const URLPatterns& patterns);
- ResourceDispatcherHost* resource_dispatcher_host_;
+ ResourceQueue* resource_queue_;
// A list of every request that we delayed. Will be flushed when user scripts
// are ready.
- typedef std::list<ResourceDispatcherHost::GlobalRequestID> DelayedRequests;
+ typedef std::list<GlobalRequestID> DelayedRequests;
DelayedRequests delayed_request_ids_;
// TODO(mpcomplete): the rest of this stuff should really be per-profile, but
@@ -83,7 +85,7 @@ class UserScriptListener
NotificationRegistrar registrar_;
- DISALLOW_EVIL_CONSTRUCTORS(UserScriptListener);
+ DISALLOW_COPY_AND_ASSIGN(UserScriptListener);
};
#endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_LISTENER_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698