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

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

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 13
14 namespace net { 14 namespace net {
15 class URLRequest; 15 class URLRequest;
16 } // namespace net 16 } // namespace net
17 17
18 class ResourceDispatcherHostRequestInfo; 18 class ResourceDispatcherHostRequestInfo;
19 struct GlobalRequestID; 19 struct GlobalRequestID;
20 20
21 // Makes decisions about delaying or not each URLRequest in the queue. 21 // Makes decisions about delaying or not each net::URLRequest in the queue.
22 // All methods are called on the IO thread. 22 // All methods are called on the IO thread.
23 class ResourceQueueDelegate { 23 class ResourceQueueDelegate {
24 public: 24 public:
25 // Should return true if it wants the |request| to not be started at this 25 // Should return true if it wants the |request| to not be started at this
26 // point. To start the delayed request, ResourceQueue::StartDelayedRequest 26 // point. To start the delayed request, ResourceQueue::StartDelayedRequest
27 // should be used. 27 // should be used.
28 virtual bool ShouldDelayRequest( 28 virtual bool ShouldDelayRequest(
29 net::URLRequest* request, 29 net::URLRequest* request,
30 const ResourceDispatcherHostRequestInfo& request_info, 30 const ResourceDispatcherHostRequestInfo& request_info,
31 const GlobalRequestID& request_id) = 0; 31 const GlobalRequestID& request_id) = 0;
(...skipping 26 matching lines...) Expand all
58 58
59 // Must be called before destroying the queue. No other methods can be called 59 // Must be called before destroying the queue. No other methods can be called
60 // after that. 60 // after that.
61 void Shutdown(); 61 void Shutdown();
62 62
63 // Takes care to start the |request| after all delegates allow that. If no 63 // Takes care to start the |request| after all delegates allow that. If no
64 // delegate demands delaying the request it will be started immediately. 64 // delegate demands delaying the request it will be started immediately.
65 void AddRequest(net::URLRequest* request, 65 void AddRequest(net::URLRequest* request,
66 const ResourceDispatcherHostRequestInfo& request_info); 66 const ResourceDispatcherHostRequestInfo& request_info);
67 67
68 // Tells the queue that the URLRequest object associated with |request_id| 68 // Tells the queue that the net::URLRequest object associated with
69 // is no longer valid. 69 // |request_id| is no longer valid.
70 void RemoveRequest(const GlobalRequestID& request_id); 70 void RemoveRequest(const GlobalRequestID& request_id);
71 71
72 // A delegate should call StartDelayedRequest when it wants to allow the 72 // A delegate should call StartDelayedRequest when it wants to allow the
73 // request to start. If it was the last delegate that demanded the request 73 // request to start. If it was the last delegate that demanded the request
74 // to be delayed, the request will be started. 74 // to be delayed, the request will be started.
75 void StartDelayedRequest(ResourceQueueDelegate* delegate, 75 void StartDelayedRequest(ResourceQueueDelegate* delegate,
76 const GlobalRequestID& request_id); 76 const GlobalRequestID& request_id);
77 77
78 private: 78 private:
79 typedef std::map<GlobalRequestID, net::URLRequest*> RequestMap; 79 typedef std::map<GlobalRequestID, net::URLRequest*> RequestMap;
80 typedef std::map<GlobalRequestID, DelegateSet> InterestedDelegatesMap; 80 typedef std::map<GlobalRequestID, DelegateSet> InterestedDelegatesMap;
81 81
82 // The registered delegates. Will not change after the queue has been 82 // The registered delegates. Will not change after the queue has been
83 // initialized. 83 // initialized.
84 DelegateSet delegates_; 84 DelegateSet delegates_;
85 85
86 // Stores URLRequest objects associated with each GlobalRequestID. This helps 86 // Stores net::URLRequest objects associated with each GlobalRequestID. This
87 // decoupling the queue from ResourceDispatcherHost. 87 // helps decoupling the queue from ResourceDispatcherHost.
88 RequestMap requests_; 88 RequestMap requests_;
89 89
90 // Maps a GlobalRequestID to the set of delegates that want to prevent the 90 // Maps a GlobalRequestID to the set of delegates that want to prevent the
91 // associated request from starting yet. 91 // associated request from starting yet.
92 InterestedDelegatesMap interested_delegates_; 92 InterestedDelegatesMap interested_delegates_;
93 93
94 // True when we are shutting down. 94 // True when we are shutting down.
95 bool shutdown_; 95 bool shutdown_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(ResourceQueue); 97 DISALLOW_COPY_AND_ASSIGN(ResourceQueue);
98 }; 98 };
99 99
100 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_ 100 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698