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

Unified Diff: content/browser/loader/mime_sniffing_resource_handler.h

Issue 2476163003: Refactor ResourceHandler API. (Closed)
Patch Set: Minor cleanups, one real fix Created 4 years, 1 month 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: content/browser/loader/mime_sniffing_resource_handler.h
diff --git a/content/browser/loader/mime_sniffing_resource_handler.h b/content/browser/loader/mime_sniffing_resource_handler.h
index 05b901a9c0cb51ca16509e4bc63b6bcf14d8ffca..28ee40f72605bf7e26b37e0bf1efb9f63e656fb4 100644
--- a/content/browser/loader/mime_sniffing_resource_handler.h
+++ b/content/browser/loader/mime_sniffing_resource_handler.h
@@ -80,12 +80,13 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
// ResourceHandler implementation:
void SetController(ResourceController* controller) override;
- bool OnWillStart(const GURL&, bool* defer) override;
- bool OnResponseStarted(ResourceResponse* response, bool* defer) override;
+ void OnWillStart(const GURL&, bool* defer_or_cancel) override;
+ void OnResponseStarted(ResourceResponse* response,
+ bool* defer_or_cancel) override;
bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
int* buf_size,
int min_size) override;
- bool OnReadCompleted(int bytes_read, bool* defer) override;
+ void OnReadCompleted(int bytes_read, bool* defer_or_cancel) override;
void OnResponseCompleted(const net::URLRequestStatus& status,
bool* defer) override;
@@ -97,22 +98,22 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
// --------------------------------------------------------------------------
// The following methods replay the buffered data to the downstream
- // ResourceHandlers. They return false if the request should be cancelled,
- // true otherwise. Each of them will set |defer| to true if the request will
- // proceed to the next stage asynchronously.
+ // ResourceHandlers. Each of them will set |defer_or_cancel| to true if the
+ // request should not synchronously continue (It was canceled, or will be
+ // continued/canceled asynchronously.
// Used to advance through the states of the state machine.
void AdvanceState();
- bool ProcessState(bool* defer);
+ void ProcessState(bool* defer_or_cancel);
// Intercepts the request as a stream/download if needed.
- bool MaybeIntercept(bool* defer);
+ void MaybeIntercept(bool* defer_or_cancel);
// Replays OnResponseStarted on the downstream handlers.
- bool ReplayResponseReceived(bool* defer);
+ void ReplayResponseReceived(bool* defer_or_cancel);
// Replays OnReadCompleted on the downstreams handlers.
- bool ReplayReadCompleted(bool* defer);
+ void ReplayReadCompleted(bool* defer_or_cancel);
// --------------------------------------------------------------------------
@@ -122,18 +123,16 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
// Checks whether this request should be intercepted as a stream or a
// download. If this is the case, sets up the new ResourceHandler that will be
- // used for interception. Returns false if teh request should be cancelled,
- // true otherwise. |defer| is set to true if the interception check needs to
- // finish asynchronously.
- bool MaybeStartInterception(bool* defer);
-
- // Determines whether a plugin will handle the current request. Returns false
- // if there is an error and the request should be cancelled and true
- // otherwise. |defer| is set to true if plugin data is stale and needs to be
- // refreshed before the request can be handled (in this case the function
- // still returns true). If the request is directed to a plugin,
- // |handled_by_plugin| is set to true.
- bool CheckForPluginHandler(bool* defer, bool* handled_by_plugin);
+ // used for interception. |defer_or_cancel| is set to true if the request will
+ // be resumed asynchronously, or was canceled.
+ void MaybeStartInterception(bool* defer_or_cancel);
+
+ // Determines whether a plugin will handle the current request.
+ // |defer_or_cancel| is set to true if plugin data is stale and needs to be
+ // refreshed before the request can be handled, or if the request was
+ // canceled. If the request is directed to a plugin, |handled_by_plugin| is
+ // set to true.
+ void CheckForPluginHandler(bool* defer_or_cancel, bool* handled_by_plugin);
// Whether this request is allowed to be intercepted as a download or a
// stream.
« no previous file with comments | « content/browser/loader/layered_resource_handler.cc ('k') | content/browser/loader/mime_sniffing_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698