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

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

Issue 2847443002: PlzNavigate: make NavigationResourceHandler a LayeredResourceHandler (Closed)
Patch Set: Addressed comments Created 3 years, 8 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/navigation_resource_handler.h
diff --git a/content/browser/loader/navigation_resource_handler.h b/content/browser/loader/navigation_resource_handler.h
index 7cf0bdbd753e41c2ce03db5d7d67b3d568e9efca..31b61a7af89cea09bf577230ef1781af212462b3 100644
--- a/content/browser/loader/navigation_resource_handler.h
+++ b/content/browser/loader/navigation_resource_handler.h
@@ -9,8 +9,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "content/browser/loader/resource_handler.h"
-#include "content/browser/loader/stream_writer.h"
+#include "content/browser/loader/layered_resource_handler.h"
+#include "content/public/browser/stream_handle.h"
namespace net {
class SSLInfo;
@@ -22,16 +22,19 @@ class ResourceController;
class ResourceDispatcherHostDelegate;
struct SSLStatus;
-// PlzNavigate: The leaf ResourceHandler used with NavigationURLLoaderImplCore.
-class NavigationResourceHandler : public ResourceHandler {
+// PlzNavigate: The ResourceHandler used with NavigationURLLoaderImplCore to
+// control the flow of navigation requests.
+class NavigationResourceHandler : public LayeredResourceHandler {
public:
static void GetSSLStatusForRequest(const net::SSLInfo& ssl_info,
SSLStatus* ssl_status);
NavigationResourceHandler(
net::URLRequest* request,
+ std::unique_ptr<ResourceHandler> next_handler,
NavigationURLLoaderImplCore* core,
- ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate);
+ ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate,
+ std::unique_ptr<StreamHandle> stream_handle);
~NavigationResourceHandler() override;
// Called by the loader the cancel the request.
@@ -43,7 +46,7 @@ class NavigationResourceHandler : public ResourceHandler {
// Called to proceed with the response.
void ProceedWithResponse();
- // ResourceHandler implementation.
+ // LayeredResourceHandler implementation.
void OnRequestRedirected(
const net::RedirectInfo& redirect_info,
ResourceResponse* response,
@@ -51,17 +54,9 @@ class NavigationResourceHandler : public ResourceHandler {
void OnResponseStarted(
ResourceResponse* response,
std::unique_ptr<ResourceController> controller) override;
- void OnWillStart(const GURL& url,
- std::unique_ptr<ResourceController> controller) override;
- void OnWillRead(scoped_refptr<net::IOBuffer>* buf,
- int* buf_size,
- std::unique_ptr<ResourceController> controller) override;
- void OnReadCompleted(int bytes_read,
- std::unique_ptr<ResourceController> controller) override;
void OnResponseCompleted(
const net::URLRequestStatus& status,
std::unique_ptr<ResourceController> controller) override;
- void OnDataDownloaded(int bytes_downloaded) override;
private:
// Clears |core_| and its reference to the resource handler. After calling
@@ -69,10 +64,15 @@ class NavigationResourceHandler : public ResourceHandler {
// NavigationURLLoader.
void DetachFromCore();
+ // Used to buffer the response and redirect info while waiting for UI thread
+ // checks to execute.
+ scoped_refptr<ResourceResponse> response_;
+ std::unique_ptr<net::RedirectInfo> redirect_info_;
+
// NavigationResourceHandler has joint ownership of the
// NavigationURLLoaderImplCore with the NavigationURLLoaderImpl.
scoped_refptr<NavigationURLLoaderImplCore> core_;
- StreamWriter writer_;
+ std::unique_ptr<StreamHandle> stream_handle_;
ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_;
DISALLOW_COPY_AND_ASSIGN(NavigationResourceHandler);
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/loader/navigation_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698