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

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

Issue 10332233: Inherits SupportsWeakPtr<T> instead of having WeakPtrFactory<T> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 class ResourceContext; 55 class ResourceContext;
56 class ResourceDispatcherHostDelegate; 56 class ResourceDispatcherHostDelegate;
57 class ResourceRequestInfoImpl; 57 class ResourceRequestInfoImpl;
58 struct DownloadSaveInfo; 58 struct DownloadSaveInfo;
59 struct GlobalRequestID; 59 struct GlobalRequestID;
60 struct Referrer; 60 struct Referrer;
61 61
62 class CONTENT_EXPORT ResourceDispatcherHostImpl 62 class CONTENT_EXPORT ResourceDispatcherHostImpl
63 : public ResourceDispatcherHost, 63 : public ResourceDispatcherHost,
64 public net::URLRequest::Delegate, 64 public net::URLRequest::Delegate,
65 public SSLErrorHandler::Delegate { 65 public SSLErrorHandler::Delegate,
66 public base::SupportsWeakPtr<ResourceDispatcherHostImpl> {
66 public: 67 public:
67 ResourceDispatcherHostImpl(); 68 ResourceDispatcherHostImpl();
68 virtual ~ResourceDispatcherHostImpl(); 69 virtual ~ResourceDispatcherHostImpl();
69 70
70 // Returns the current ResourceDispatcherHostImpl. May return NULL if it 71 // Returns the current ResourceDispatcherHostImpl. May return NULL if it
71 // hasn't been created yet. 72 // hasn't been created yet.
72 static ResourceDispatcherHostImpl* Get(); 73 static ResourceDispatcherHostImpl* Get();
73 74
74 // ResourceDispatcherHost implementation: 75 // ResourceDispatcherHost implementation:
75 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; 76 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 470
470 // Request ID for browser initiated requests. request_ids generated by 471 // Request ID for browser initiated requests. request_ids generated by
471 // child processes are counted up from 0, while browser created requests 472 // child processes are counted up from 0, while browser created requests
472 // start at -2 and go down from there. (We need to start at -2 because -1 is 473 // start at -2 and go down from there. (We need to start at -2 because -1 is
473 // used as a special value all over the resource_dispatcher_host for 474 // used as a special value all over the resource_dispatcher_host for
474 // uninitialized variables.) This way, we no longer have the unlikely (but 475 // uninitialized variables.) This way, we no longer have the unlikely (but
475 // observed in the real world!) event where we have two requests with the same 476 // observed in the real world!) event where we have two requests with the same
476 // request_id_. 477 // request_id_.
477 int request_id_; 478 int request_id_;
478 479
479 // For running tasks.
480 base::WeakPtrFactory<ResourceDispatcherHostImpl> weak_factory_;
481
482 // For SSLErrorHandler::Delegate calls from SSLManager.
483 base::WeakPtrFactory<SSLErrorHandler::Delegate> ssl_delegate_weak_factory_;
484
485 // True if the resource dispatcher host has been shut down. 480 // True if the resource dispatcher host has been shut down.
486 bool is_shutdown_; 481 bool is_shutdown_;
487 482
488 typedef std::vector<net::URLRequest*> BlockedRequestsList; 483 typedef std::vector<net::URLRequest*> BlockedRequestsList;
489 typedef std::pair<int, int> ProcessRouteIDs; 484 typedef std::pair<int, int> ProcessRouteIDs;
490 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; 485 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap;
491 BlockedRequestMap blocked_requests_map_; 486 BlockedRequestMap blocked_requests_map_;
492 487
493 // Maps the child_ids to the approximate number of bytes 488 // Maps the child_ids to the approximate number of bytes
494 // being used to service its resource requests. No entry implies 0 cost. 489 // being used to service its resource requests. No entry implies 0 cost.
(...skipping 30 matching lines...) Expand all
525 // http://crbug.com/90971 - Assists in tracking down use-after-frees on 520 // http://crbug.com/90971 - Assists in tracking down use-after-frees on
526 // shutdown. 521 // shutdown.
527 std::set<const ResourceContext*> active_resource_contexts_; 522 std::set<const ResourceContext*> active_resource_contexts_;
528 523
529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 524 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
530 }; 525 };
531 526
532 } // namespace content 527 } // namespace content
533 528
534 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ 529 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698