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

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

Issue 2919313004: Get rid of URLLoaderFactory in browser-side case (Closed)
Patch Set: . Created 3 years, 6 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: content/browser/loader/url_loader_request_handler.h
diff --git a/content/browser/loader/url_loader_request_handler.h b/content/browser/loader/url_loader_request_handler.h
index f72cc2a88e5d2cd45ef1d7ef6356387276b4cd1f..c214890fce1eed19e89bd76fb78598e72e629175 100644
--- a/content/browser/loader/url_loader_request_handler.h
+++ b/content/browser/loader/url_loader_request_handler.h
@@ -14,8 +14,7 @@ namespace content {
class ResourceContext;
struct ResourceRequest;
-using LoaderFactoryCallback =
- base::OnceCallback<void(mojom::URLLoaderFactory*)>;
+using URLLoaderCallback = base::OnceCallback<void(mojom::URLLoader*)>;
// An instance of this class is a per-request object and kept around during
// the lifetime of a request (including multiple redirect legs) on IO thread.
@@ -24,21 +23,16 @@ class CONTENT_EXPORT URLLoaderRequestHandler {
URLLoaderRequestHandler() = default;
virtual ~URLLoaderRequestHandler() = default;
- // Calls |callback| with non-null factory if this handler can handle
- // the request, calls it with nullptr otherwise.
+ // Calls |callback| with a non-null URLLoader that is not started yet
+ // if this handler can handle the request, calls it with nullptr otherwise.
// Some implementation notes:
- // 1) The returned pointer needs to be valid only until a single
- // CreateLoaderAndStart call is made, and it is okay to do CHECK(false) for
- // any subsequent calls.
- // 2) The implementor is not supposed to set up and return URLLoaderFactory
- // until it finds out that the handler is really going to handle the
- // request. (For example ServiceWorker's request handler would not need to
- // call the callback until it gets response from SW, and it may still
- // call the callback with nullptr if it turns out that it needs to fallback
- // to the network.)
- virtual void MaybeCreateLoaderFactory(const ResourceRequest& resource_request,
- ResourceContext* resource_context,
- LoaderFactoryCallback callback) = 0;
+ // 1) The caller will immediately call Start() method on the returned ptr
+ // if it is non-null.
+ // 2) The implementor is not supposed to set up and return URLLoader until
+ // it finds out that the handler is really going to handle the request.
+ virtual void MaybeCreateLoader(const ResourceRequest& resource_request,
jam 2017/06/05 19:39:24 I'm probably missing something, but why can't this
michaeln 2017/06/05 21:52:39 There is a use case for a non-started loaders. Lo
jam 2017/06/06 00:07:45 This could also be implemented by using a callback
jam 2017/06/06 00:55:40 (I'm guessing I'm missing the obvious reason here,
+ ResourceContext* resource_context,
+ URLLoaderCallback callback) = 0;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698