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

Side by Side 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: Change delay from 3s to 60s for initial timing. Obey the browser process when it wants to cancel. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/timer/timer.h"
11 #include "content/browser/loader/resource_handler.h" 12 #include "content/browser/loader/resource_handler.h"
12 #include "content/browser/ssl/ssl_error_handler.h" 13 #include "content/browser/ssl/ssl_error_handler.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 #include "content/public/browser/resource_controller.h" 15 #include "content/public/browser/resource_controller.h"
15 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
16 17
17 namespace net { 18 namespace net {
18 class ClientCertStore; 19 class ClientCertStore;
19 } 20 }
20 21
(...skipping 26 matching lines...) Expand all
47 48
48 net::URLRequest* request() { return request_.get(); } 49 net::URLRequest* request() { return request_.get(); }
49 ResourceRequestInfoImpl* GetRequestInfo(); 50 ResourceRequestInfoImpl* GetRequestInfo();
50 51
51 void ClearLoginDelegate(); 52 void ClearLoginDelegate();
52 void ClearSSLClientAuthHandler(); 53 void ClearSSLClientAuthHandler();
53 54
54 // IPC message handlers: 55 // IPC message handlers:
55 void OnUploadProgressACK(); 56 void OnUploadProgressACK();
56 57
58 static void set_delay_prefetch_cancel_ms(int cancel_ms) {
59 ResourceLoader::delay_prefetch_cancel_ms_ = cancel_ms;
60 }
61
57 private: 62 private:
58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); 63 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup);
59 64
60 ResourceLoader(scoped_ptr<net::URLRequest> request, 65 ResourceLoader(scoped_ptr<net::URLRequest> request,
61 scoped_ptr<ResourceHandler> handler, 66 scoped_ptr<ResourceHandler> handler,
62 ResourceLoaderDelegate* delegate, 67 ResourceLoaderDelegate* delegate,
63 scoped_ptr<net::ClientCertStore> client_cert_store); 68 scoped_ptr<net::ClientCertStore> client_cert_store);
64 69
65 // Initialization logic shared between the public and private constructor. 70 // Initialization logic shared between the public and private constructor.
66 void Init(scoped_ptr<net::URLRequest> request, 71 void Init(scoped_ptr<net::URLRequest> request,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 uint64 last_upload_position_; 131 uint64 last_upload_position_;
127 bool waiting_for_upload_progress_ack_; 132 bool waiting_for_upload_progress_ack_;
128 base::TimeTicks last_upload_ticks_; 133 base::TimeTicks last_upload_ticks_;
129 base::TimeTicks read_deferral_start_time_; 134 base::TimeTicks read_deferral_start_time_;
130 135
131 // Indicates that we are in a state of being transferred to a new downstream 136 // Indicates that we are in a state of being transferred to a new downstream
132 // consumer. We are waiting for a notification to complete the transfer, at 137 // consumer. We are waiting for a notification to complete the transfer, at
133 // which point we'll receive a new ResourceHandler. 138 // which point we'll receive a new ResourceHandler.
134 bool is_transferring_; 139 bool is_transferring_;
135 140
141 scoped_ptr<base::OneShotTimer<ResourceLoader> > prefetch_timer_;
142
136 scoped_ptr<net::ClientCertStore> client_cert_store_; 143 scoped_ptr<net::ClientCertStore> client_cert_store_;
137 144
138 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; 145 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_;
139 146
147 // The time in ms to delay a cancel of a prefetch.
148 static int delay_prefetch_cancel_ms_;
149
140 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); 150 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
141 }; 151 };
142 152
143 } // namespace content 153 } // namespace content
144 154
145 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 155 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698