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

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

Issue 9836066: Have content cancel requests for ResourceContexts when they shutdown, instead of depending on the e… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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) 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 // 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ResourceDispatcherHostImpl(); 65 ResourceDispatcherHostImpl();
66 virtual ~ResourceDispatcherHostImpl(); 66 virtual ~ResourceDispatcherHostImpl();
67 67
68 // Returns the current ResourceDispatcherHostImpl. May return NULL if it 68 // Returns the current ResourceDispatcherHostImpl. May return NULL if it
69 // hasn't been created yet. 69 // hasn't been created yet.
70 static ResourceDispatcherHostImpl* Get(); 70 static ResourceDispatcherHostImpl* Get();
71 71
72 // ResourceDispatcherHost implementation: 72 // ResourceDispatcherHost implementation:
73 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; 73 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE;
74 virtual void SetAllowCrossOriginAuthPrompt(bool value) OVERRIDE; 74 virtual void SetAllowCrossOriginAuthPrompt(bool value) OVERRIDE;
75 virtual void CancelRequestsForContext(ResourceContext* context) OVERRIDE;
76 virtual net::Error BeginDownload( 75 virtual net::Error BeginDownload(
77 scoped_ptr<net::URLRequest> request, 76 scoped_ptr<net::URLRequest> request,
78 ResourceContext* context, 77 ResourceContext* context,
79 int child_id, 78 int child_id,
80 int route_id, 79 int route_id,
81 bool prefer_cache, 80 bool prefer_cache,
82 const DownloadSaveInfo& save_info, 81 const DownloadSaveInfo& save_info,
83 const DownloadStartedCallback& started_callback) OVERRIDE; 82 const DownloadStartedCallback& started_callback) OVERRIDE;
84 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; 83 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE;
85 virtual void MarkAsTransferredNavigation(net::URLRequest* request) OVERRIDE; 84 virtual void MarkAsTransferredNavigation(net::URLRequest* request) OVERRIDE;
86 85
87 // Puts the resource dispatcher host in an inactive state (unable to begin 86 // Puts the resource dispatcher host in an inactive state (unable to begin
88 // new requests). Cancels all pending requests. 87 // new requests). Cancels all pending requests.
89 void Shutdown(); 88 void Shutdown();
90 89
90 // Force cancels any pending requests for the given |context|. This is
91 // necessary to ensure that before |context| goes away, all requests
92 // for it are dead.
93 void CancelRequestsForContext(ResourceContext* context);
94
91 // Returns true if the message was a resource message that was processed. 95 // Returns true if the message was a resource message that was processed.
92 // If it was, message_was_ok will be false iff the message was corrupt. 96 // If it was, message_was_ok will be false iff the message was corrupt.
93 bool OnMessageReceived(const IPC::Message& message, 97 bool OnMessageReceived(const IPC::Message& message,
94 ResourceMessageFilter* filter, 98 ResourceMessageFilter* filter,
95 bool* message_was_ok); 99 bool* message_was_ok);
96 100
97 // Initiates a save file from the browser process (as opposed to a resource 101 // Initiates a save file from the browser process (as opposed to a resource
98 // request from the renderer or another child process). 102 // request from the renderer or another child process).
99 void BeginSaveFile(const GURL& url, 103 void BeginSaveFile(const GURL& url,
100 const GURL& referrer, 104 const GURL& referrer,
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // to the respective request. 500 // to the respective request.
497 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations; 501 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations;
498 TransferredNavigations transferred_navigations_; 502 TransferredNavigations transferred_navigations_;
499 503
500 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 504 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
501 }; 505 };
502 506
503 } // namespace content 507 } // namespace content
504 508
505 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ 509 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698