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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.h

Issue 7038012: Safely cancel prerenders on threads other than the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to Dominic's comments, part 2 Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This is the browser side of the resource dispatcher, it receives requests 5 // This is the browser side of the resource dispatcher, it receives requests
6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and
7 // dispatches them to URLRequests. It then forwards the messages from the 7 // dispatches them to URLRequests. It then forwards the messages from the
8 // URLRequests back to the correct process for handling. 8 // URLRequests back to the correct process for handling.
9 // 9 //
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void UnregisterDownloadedTempFile(int child_id, int request_id); 237 void UnregisterDownloadedTempFile(int child_id, int request_id);
238 238
239 // Needed for the sync IPC message dispatcher macros. 239 // Needed for the sync IPC message dispatcher macros.
240 bool Send(IPC::Message* message); 240 bool Send(IPC::Message* message);
241 241
242 // Controls if we launch or squash prefetch requests as they arrive 242 // Controls if we launch or squash prefetch requests as they arrive
243 // from renderers. 243 // from renderers.
244 static bool is_prefetch_enabled(); 244 static bool is_prefetch_enabled();
245 static void set_is_prefetch_enabled(bool value); 245 static void set_is_prefetch_enabled(bool value);
246 246
247 void AddPrerenderChildRoutePair(int child_id, int route_id);
248 void RemovePrerenderChildRoutePair(int child_id, int route_id);
249
250 typedef std::set<std::pair<int, int> > PrerenderChildRouteIdPairs;
251 const PrerenderChildRouteIdPairs& prerender_child_route_id_pairs() const {
252 return prerender_child_route_pairs_;
253 }
254
255 private: 247 private:
256 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 248 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
257 TestBlockedRequestsProcessDies); 249 TestBlockedRequestsProcessDies);
258 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 250 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
259 IncrementOutstandingRequestsMemoryCost); 251 IncrementOutstandingRequestsMemoryCost);
260 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 252 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
261 CalculateApproximateMemoryCost); 253 CalculateApproximateMemoryCost);
262 254
263 class ShutdownTask; 255 class ShutdownTask;
264 256
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 int route_id); // only valid for async 369 int route_id); // only valid for async
378 void OnDataReceivedACK(int request_id); 370 void OnDataReceivedACK(int request_id);
379 void OnDataDownloadedACK(int request_id); 371 void OnDataDownloadedACK(int request_id);
380 void OnUploadProgressACK(int request_id); 372 void OnUploadProgressACK(int request_id);
381 void OnCancelRequest(int request_id); 373 void OnCancelRequest(int request_id);
382 void OnFollowRedirect(int request_id, 374 void OnFollowRedirect(int request_id,
383 bool has_new_first_party_for_cookies, 375 bool has_new_first_party_for_cookies,
384 const GURL& new_first_party_for_cookies); 376 const GURL& new_first_party_for_cookies);
385 void OnReleaseDownloadedFile(int request_id); 377 void OnReleaseDownloadedFile(int request_id);
386 378
387 bool IsPrerenderingChildRoutePair(int child_id, int route_id) const;
388
389 ResourceHandler* CreateSafeBrowsingResourceHandler( 379 ResourceHandler* CreateSafeBrowsingResourceHandler(
390 ResourceHandler* handler, int child_id, int route_id, 380 ResourceHandler* handler, int child_id, int route_id,
391 ResourceType::Type resource_type); 381 ResourceType::Type resource_type);
392 382
393 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request 383 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request
394 // (a download or a page save). |download| should be true if the request 384 // (a download or a page save). |download| should be true if the request
395 // is a file download. 385 // is a file download.
396 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( 386 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest(
397 ResourceHandler* handler, 387 ResourceHandler* handler,
398 int child_id, 388 int child_id,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // The total number of outstanding requests is roughly: 470 // The total number of outstanding requests is roughly:
481 // (max_outstanding_requests_cost_per_process_ / 471 // (max_outstanding_requests_cost_per_process_ /
482 // kAvgBytesPerOutstandingRequest) 472 // kAvgBytesPerOutstandingRequest)
483 int max_outstanding_requests_cost_per_process_; 473 int max_outstanding_requests_cost_per_process_;
484 474
485 // Used during IPC message dispatching so that the handlers can get a pointer 475 // Used during IPC message dispatching so that the handlers can get a pointer
486 // to the source of the message. 476 // to the source of the message.
487 ResourceMessageFilter* filter_; 477 ResourceMessageFilter* filter_;
488 478
489 static bool is_prefetch_enabled_; 479 static bool is_prefetch_enabled_;
490 PrerenderChildRouteIdPairs prerender_child_route_pairs_;
491 480
492 481
493 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); 482 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
494 }; 483 };
495 484
496 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ 485 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698