OLD | NEW |
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 #ifndef NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ | 5 #ifndef NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ |
6 #define NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ | 6 #define NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // For each thread that is created, an accompanying synchronous ProxyResolver | 81 // For each thread that is created, an accompanying synchronous ProxyResolver |
82 // will be provisioned using |resolver_factory|. All methods on these | 82 // will be provisioned using |resolver_factory|. All methods on these |
83 // ProxyResolvers will be called on the one thread, with the exception of | 83 // ProxyResolvers will be called on the one thread, with the exception of |
84 // ProxyResolver::Shutdown() which will be called from the origin thread | 84 // ProxyResolver::Shutdown() which will be called from the origin thread |
85 // prior to destruction. | 85 // prior to destruction. |
86 // | 86 // |
87 // The constructor takes ownership of |resolver_factory|. | 87 // The constructor takes ownership of |resolver_factory|. |
88 MultiThreadedProxyResolver(ProxyResolverFactory* resolver_factory, | 88 MultiThreadedProxyResolver(ProxyResolverFactory* resolver_factory, |
89 size_t max_num_threads); | 89 size_t max_num_threads); |
90 | 90 |
91 virtual ~MultiThreadedProxyResolver(); | 91 ~MultiThreadedProxyResolver() override; |
92 | 92 |
93 // ProxyResolver implementation: | 93 // ProxyResolver implementation: |
94 virtual int GetProxyForURL(const GURL& url, | 94 int GetProxyForURL(const GURL& url, |
95 ProxyInfo* results, | 95 ProxyInfo* results, |
96 const CompletionCallback& callback, | 96 const CompletionCallback& callback, |
97 RequestHandle* request, | 97 RequestHandle* request, |
98 const BoundNetLog& net_log) override; | 98 const BoundNetLog& net_log) override; |
99 virtual void CancelRequest(RequestHandle request) override; | 99 void CancelRequest(RequestHandle request) override; |
100 virtual LoadState GetLoadState(RequestHandle request) const override; | 100 LoadState GetLoadState(RequestHandle request) const override; |
101 virtual void CancelSetPacScript() override; | 101 void CancelSetPacScript() override; |
102 virtual int SetPacScript( | 102 int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data, |
103 const scoped_refptr<ProxyResolverScriptData>& script_data, | 103 const CompletionCallback& callback) override; |
104 const CompletionCallback& callback) override; | |
105 | 104 |
106 private: | 105 private: |
107 class Executor; | 106 class Executor; |
108 class Job; | 107 class Job; |
109 class SetPacScriptJob; | 108 class SetPacScriptJob; |
110 class GetProxyForURLJob; | 109 class GetProxyForURLJob; |
111 // FIFO queue of pending jobs waiting to be started. | 110 // FIFO queue of pending jobs waiting to be started. |
112 // TODO(eroman): Make this priority queue. | 111 // TODO(eroman): Make this priority queue. |
113 typedef std::deque<scoped_refptr<Job> > PendingJobsQueue; | 112 typedef std::deque<scoped_refptr<Job> > PendingJobsQueue; |
114 typedef std::vector<scoped_refptr<Executor> > ExecutorList; | 113 typedef std::vector<scoped_refptr<Executor> > ExecutorList; |
(...skipping 18 matching lines...) Expand all Loading... |
133 const scoped_ptr<ProxyResolverFactory> resolver_factory_; | 132 const scoped_ptr<ProxyResolverFactory> resolver_factory_; |
134 const size_t max_num_threads_; | 133 const size_t max_num_threads_; |
135 PendingJobsQueue pending_jobs_; | 134 PendingJobsQueue pending_jobs_; |
136 ExecutorList executors_; | 135 ExecutorList executors_; |
137 scoped_refptr<ProxyResolverScriptData> current_script_data_; | 136 scoped_refptr<ProxyResolverScriptData> current_script_data_; |
138 }; | 137 }; |
139 | 138 |
140 } // namespace net | 139 } // namespace net |
141 | 140 |
142 #endif // NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ | 141 #endif // NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ |
OLD | NEW |