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

Unified Diff: content/browser/loader/resource_loader.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: Created a detached state. Data is sent to renderer until detached. Fixed up tests. 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/resource_loader.h
diff --git a/content/browser/loader/resource_loader.h b/content/browser/loader/resource_loader.h
index 6a611a723f5815b8a29fe9984552003b38f9b25a..1052b8f9c7d6eab06eecc9d2534e953bd402eb56 100644
--- a/content/browser/loader/resource_loader.h
+++ b/content/browser/loader/resource_loader.h
@@ -8,6 +8,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
#include "content/browser/loader/resource_handler.h"
#include "content/browser/ssl/ssl_error_handler.h"
#include "content/common/content_export.h"
@@ -39,6 +40,10 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
void StartRequest();
void CancelRequest(bool from_renderer);
+ // Sets the resource as detached and starts a timer to cancel the request in
+ // the future.
+ void Detach();
+
void ReportUploadProgress();
bool is_transferring() const { return is_transferring_; }
@@ -54,6 +59,10 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
// IPC message handlers:
void OnUploadProgressACK();
+ void set_detachable_delay_ms(int delay) {
+ detachable_delay_on_cancel_ms_ = delay;
+ }
+
private:
FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup);
@@ -97,6 +106,7 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
void StartRequestInternal();
void CancelRequestInternal(int error, bool from_renderer);
+
void CompleteResponseStarted();
void StartReading(bool is_continuation);
void ResumeReading();
@@ -133,6 +143,10 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
// which point we'll receive a new ResourceHandler.
bool is_transferring_;
+ int detachable_delay_on_cancel_ms_;
+
+ scoped_ptr<base::OneShotTimer<ResourceLoader> > detached_timer_;
+
scoped_ptr<net::ClientCertStore> client_cert_store_;
base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698