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

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

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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
Index: content/browser/loader/navigation_url_loader_core.h
diff --git a/content/browser/loader/navigation_url_loader_core.h b/content/browser/loader/navigation_url_loader_core.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebdd3fac419571dc7fae558eea0261c4297b4b20
--- /dev/null
+++ b/content/browser/loader/navigation_url_loader_core.h
@@ -0,0 +1,100 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_CORE_H_
+#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_CORE_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/loader/navigation_url_loader.h"
+
+namespace net {
+class URLRequest;
+struct RedirectInfo;
+}
+
+namespace content {
+
+class BrowserContext;
+class FrameTreeNode;
+class NavigationResourceHandler;
+class ResourceContext;
+class ResourceHandler;
+class ResourceRequestBody;
+class StreamHandle;
+struct ResourceResponse;
+
+// Part of the implementation of NavigationURLLoaderImpl. It is jointly owned by
+// NavigationURLLoaderImpl on the UI thread and NavigationResourceHandler and IO
+// thread. It bridges cross-thread between the two.
mmenke 2014/09/23 17:22:45 nit: "It bridges cross-thread between the two."
davidben 2014/10/03 16:27:52 Done.
+class NavigationURLLoaderCore
+ : public base::RefCountedThreadSafe<NavigationURLLoaderCore> {
+ public:
+ NavigationURLLoaderCore();
+
+ // Called on the UI thread to start the request.
+ void StartRequest(BrowserContext* browser_context,
+ int64 frame_tree_node_id,
+ const NavigationRequestInfo& request_info,
+ ResourceRequestBody* request_body);
+
+ // Called on the UI thread to set the delegate.
+ void set_delegate(NavigationURLLoader::Delegate* delegate) {
+ delegate_ = delegate;
+ }
+
+ // Called on the UI thread to resume a deferred redirect.
+ void FollowRedirect();
+
+ // Called on the UI thread to cancel a request, if it has not completed. Note:
nasko 2014/09/24 21:15:34 nit: Note: on new line
davidben 2014/10/03 16:27:52 Done.
+ // if the response has been received, the request is considered completed from
nasko 2014/09/24 21:15:34 The full response or the response headers? Let's b
davidben 2014/10/03 16:27:52 Done.
+ // the perspective of NavigationURLLoader and ownership is transferred to the
+ // StreamHandle containing the body.
+ void Cancel();
+
+ // Called on the IO thread to set the resource handler.
+ void set_resource_handler(NavigationResourceHandler* resource_handler) {
+ resource_handler_ = resource_handler;
+ }
+
+ // Called on the IO thread when the request is redirected. The request will
+ // resume processing on the next call to FollowRedirect on the UI thread.
+ void RequestRedirectedOnIOThread(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response);
+
+ // Called on the IO thread when the response started.
+ void ResponseStartedOnIOThread(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body);
+
+ // Called on the IO thread if the request failed before giving a response.
+ void RequestFailedOnIOThread(int net_error);
+
+ private:
+ friend class base::RefCountedThreadSafe<NavigationURLLoaderCore>;
+
+ ~NavigationURLLoaderCore();
+
+ void StartRequestOnIOThread(ResourceContext* resource_context,
+ int64 frame_tree_node_id,
mmenke 2014/09/23 17:22:45 Should include basictypes.h, I believe, for int64
davidben 2014/10/03 16:27:52 Done.
+ const NavigationRequestInfo& request_info,
+ ResourceRequestBody* request_body);
+ void FollowRedirectOnIOThread();
+ void CancelOnIOThread();
+
+ void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response);
+ void CallOnResponseStarted(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body);
+ void CallOnRequestFailed(int net_error);
+
+ NavigationURLLoader::Delegate* delegate_;
+ NavigationResourceHandler* resource_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderCore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_

Powered by Google App Engine
This is Rietveld 408576698