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

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

Issue 25772002: Allows prefetch requests to live beyond the renderer by delaying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing great comments from mmenke. Created 7 years, 2 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/detached_resource_handler.h
diff --git a/content/browser/loader/detached_resource_handler.h b/content/browser/loader/detached_resource_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..f913ec84972eda9d1b982ceac482f7b2a72315fb
--- /dev/null
+++ b/content/browser/loader/detached_resource_handler.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2013 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_DETACHED_RESOURCE_HANDLER_H_
+#define CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "content/browser/loader/resource_handler.h"
+#include "content/browser/loader/resource_message_delegate.h"
+#include "url/gurl.h"
+
+namespace net {
+class URLRequest;
+class IOBuffer;
+}
+
+namespace content {
+class ResourceDispatcherHostImpl;
+
+// Used to complete an asynchronous resource request in which the renderer only
+// cares about load and error events, and does not want to see the bytes. The
+// handler will continue if the renderer dissappears.
asanka 2013/10/11 21:01:20 Nit: s/ss/s/
jkarlin2 2013/10/14 14:30:00 Done.
+class DetachedResourceHandler : public ResourceHandler {
+ public:
+ DetachedResourceHandler(net::URLRequest* request,
+ ResourceDispatcherHostImpl* rdh);
+
+ virtual ~DetachedResourceHandler();
+
+ // ResourceHandler implementation:
+ virtual bool OnUploadProgress(int request_id, uint64 position,
+ uint64 size) OVERRIDE;
+
+ virtual bool OnResponseStarted(int request_id, ResourceResponse* response,
+ bool* defer) OVERRIDE;
+
+ virtual bool OnWillStart(int request_id, const GURL& url,
+ bool* defer) OVERRIDE;
+
+ virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
+ int min_size) OVERRIDE;
+
+ virtual bool OnReadCompleted(int request_id, int bytes_read,
+ bool* defer) OVERRIDE;
+
+ virtual bool OnRequestRedirected(int request_id, const GURL& new_url,
+ ResourceResponse* response,
+ bool* defer) OVERRIDE;
+
+ virtual bool OnResponseCompleted(int request_id,
+ const net::URLRequestStatus& status,
+ const std::string& security_info) OVERRIDE;
+
+ virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE;
+
+ private:
+ net::URLRequest* request_;
+ ResourceDispatcherHostImpl* rdh_;
+ scoped_refptr<net::IOBuffer> read_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DetachedResourceHandler);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698