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

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

Issue 10914319: UserScriptListener: Don't resume requests that it didn't defer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix bad comment Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_listener_unittest.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.cc
===================================================================
--- chrome/browser/extensions/user_script_listener.cc (revision 156237)
+++ chrome/browser/extensions/user_script_listener.cc (working copy)
@@ -25,14 +25,29 @@
: public ResourceThrottle,
public base::SupportsWeakPtr<UserScriptListener::Throttle> {
public:
+ Throttle() : should_defer_(true), did_defer_(false) {
+ }
+
void Resume() {
- controller()->Resume();
+ DCHECK(should_defer_);
+ should_defer_ = false;
+ // Only resume the request if |this| has deferred it.
+ if (did_defer_)
+ controller()->Resume();
}
// ResourceThrottle implementation:
virtual void WillStartRequest(bool* defer) {
- *defer = true;
+ // Only defer requests if Resume has not yet been called.
+ if (should_defer_) {
+ *defer = true;
+ did_defer_ = true;
+ }
}
+
+ private:
+ bool should_defer_;
+ bool did_defer_;
};
struct UserScriptListener::ProfileData {
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698