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

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

Issue 67019: URLRequest::Interceptor enhancements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 fowards the messages from the 7 // dispatches them to URLRequests. It then fowards 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const GURL& new_url); 302 const GURL& new_url);
303 virtual void OnAuthRequired(URLRequest* request, 303 virtual void OnAuthRequired(URLRequest* request,
304 net::AuthChallengeInfo* auth_info); 304 net::AuthChallengeInfo* auth_info);
305 virtual void OnSSLCertificateError(URLRequest* request, 305 virtual void OnSSLCertificateError(URLRequest* request,
306 int cert_error, 306 int cert_error,
307 net::X509Certificate* cert); 307 net::X509Certificate* cert);
308 virtual void OnResponseStarted(URLRequest* request); 308 virtual void OnResponseStarted(URLRequest* request);
309 virtual void OnReadCompleted(URLRequest* request, int bytes_read); 309 virtual void OnReadCompleted(URLRequest* request, int bytes_read);
310 void OnResponseCompleted(URLRequest* request); 310 void OnResponseCompleted(URLRequest* request);
311 311
312 // Helper function to get our extra data out of a request. The given request 312 // Helper functions to get our extra data out of a request. The given request
313 // must have been one we created so that it has the proper extra data pointer. 313 // must have been one we created so that it has the proper extra data pointer.
314 static ExtraRequestInfo* ExtraInfoForRequest(URLRequest* request) { 314 static ExtraRequestInfo* ExtraInfoForRequest(URLRequest* request) {
315 ExtraRequestInfo* r = static_cast<ExtraRequestInfo*>(request->user_data()); 315 ExtraRequestInfo* info
316 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data"; 316 = static_cast<ExtraRequestInfo*>(request->GetUserData(NULL));
317 return r; 317 DLOG_IF(WARNING, !info) << "Request doesn't seem to have our data";
318 return info;
318 } 319 }
319 320
320 static const ExtraRequestInfo* ExtraInfoForRequest( 321 static const ExtraRequestInfo* ExtraInfoForRequest(
321 const URLRequest* request) { 322 const URLRequest* request) {
322 const ExtraRequestInfo* r = 323 const ExtraRequestInfo* info =
323 static_cast<const ExtraRequestInfo*>(request->user_data()); 324 static_cast<const ExtraRequestInfo*>(request->GetUserData(NULL));
324 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data"; 325 DLOG_IF(WARNING, !info) << "Request doesn't seem to have our data";
325 return r; 326 return info;
326 } 327 }
327 328
328 // Adds an observer. The observer will be called on the IO thread. To 329 // Adds an observer. The observer will be called on the IO thread. To
329 // observe resource events on the UI thread, subscribe to the 330 // observe resource events on the UI thread, subscribe to the
330 // NOTIFY_RESOURCE_* notifications of the notification service. 331 // NOTIFY_RESOURCE_* notifications of the notification service.
331 void AddObserver(Observer* obs); 332 void AddObserver(Observer* obs);
332 333
333 // Removes an observer. 334 // Removes an observer.
334 void RemoveObserver(Observer* obs); 335 void RemoveObserver(Observer* obs);
335 336
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 FRIEND_TEST(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies); 374 FRIEND_TEST(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies);
374 FRIEND_TEST(ResourceDispatcherHostTest, 375 FRIEND_TEST(ResourceDispatcherHostTest,
375 IncrementOutstandingRequestsMemoryCost); 376 IncrementOutstandingRequestsMemoryCost);
376 FRIEND_TEST(ResourceDispatcherHostTest, 377 FRIEND_TEST(ResourceDispatcherHostTest,
377 CalculateApproximateMemoryCost); 378 CalculateApproximateMemoryCost);
378 379
379 class ShutdownTask; 380 class ShutdownTask;
380 381
381 friend class ShutdownTask; 382 friend class ShutdownTask;
382 383
384 void SetExtraInfoForRequest(URLRequest* request, ExtraRequestInfo* info) {
385 request->SetUserData(NULL, info);
386 }
387
383 // A shutdown helper that runs on the IO thread. 388 // A shutdown helper that runs on the IO thread.
384 void OnShutdown(); 389 void OnShutdown();
385 390
386 // Returns true if the request is paused. 391 // Returns true if the request is paused.
387 bool PauseRequestIfNeeded(ExtraRequestInfo* info); 392 bool PauseRequestIfNeeded(ExtraRequestInfo* info);
388 393
389 // Resumes the given request by calling OnResponseStarted or OnReadCompleted. 394 // Resumes the given request by calling OnResponseStarted or OnReadCompleted.
390 void ResumeRequest(const GlobalRequestID& request_id); 395 void ResumeRequest(const GlobalRequestID& request_id);
391 396
392 // Reads data from the response using our internal buffer as async IO. 397 // Reads data from the response using our internal buffer as async IO.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 int max_outstanding_requests_cost_per_process_; 553 int max_outstanding_requests_cost_per_process_;
549 554
550 // Used during IPC message dispatching so that the handlers can get a pointer 555 // Used during IPC message dispatching so that the handlers can get a pointer
551 // to the source of the message. 556 // to the source of the message.
552 Receiver* receiver_; 557 Receiver* receiver_;
553 558
554 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); 559 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
555 }; 560 };
556 561
557 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ 562 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698