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

Side by Side Diff: net/proxy/single_threaded_proxy_resolver.h

Issue 160510: Better match IE's proxy settings.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix merge conflict Created 11 years, 4 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 | « net/proxy/proxy_service_unittest.cc ('k') | net/proxy/single_threaded_proxy_resolver.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) 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 NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_ 5 #ifndef NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
6 #define NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_ 6 #define NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 19 matching lines...) Expand all
30 explicit SingleThreadedProxyResolver(ProxyResolver* resolver); 30 explicit SingleThreadedProxyResolver(ProxyResolver* resolver);
31 31
32 virtual ~SingleThreadedProxyResolver(); 32 virtual ~SingleThreadedProxyResolver();
33 33
34 // ProxyResolver implementation: 34 // ProxyResolver implementation:
35 virtual int GetProxyForURL(const GURL& url, 35 virtual int GetProxyForURL(const GURL& url,
36 ProxyInfo* results, 36 ProxyInfo* results,
37 CompletionCallback* callback, 37 CompletionCallback* callback,
38 RequestHandle* request); 38 RequestHandle* request);
39 virtual void CancelRequest(RequestHandle request); 39 virtual void CancelRequest(RequestHandle request);
40 virtual void CancelSetPacScript();
40 41
41 protected: 42 protected:
42 // The wrapped (synchronous) ProxyResolver. 43 // The wrapped (synchronous) ProxyResolver.
43 ProxyResolver* resolver() { return resolver_.get(); } 44 ProxyResolver* resolver() { return resolver_.get(); }
44 45
45 private: 46 private:
46 // Refcounted helper class that bridges between origin thread and worker 47 // Refcounted helper class that bridges between origin thread and worker
47 // thread. 48 // thread.
48 class Job; 49 class Job;
49 friend class Job; 50 friend class Job;
51 class SetPacScriptTask;
52 friend class SetPacScriptTask;
50 // FIFO queue that contains the in-progress job, and any pending jobs. 53 // FIFO queue that contains the in-progress job, and any pending jobs.
51 typedef std::deque<scoped_refptr<Job> > PendingJobsQueue; 54 typedef std::deque<scoped_refptr<Job> > PendingJobsQueue;
52 55
53 base::Thread* thread() { return thread_.get(); } 56 base::Thread* thread() { return thread_.get(); }
54 57
55 // ProxyResolver implementation: 58 // ProxyResolver implementation:
56 virtual void SetPacScriptByUrlInternal(const GURL& pac_url); 59 virtual int SetPacScript(const GURL& pac_url,
57 virtual void SetPacScriptByDataInternal(const std::string& bytes); 60 const std::string& pac_bytes,
58 61 CompletionCallback* callback);
59 // Helper for shared code between SetPacScriptByUrlInternal() and
60 // SetPacScriptByDataInternal() -- the unused parameter is set to empty.
61 void SetPacScriptHelper(const GURL& pac_url, const std::string& bytes);
62 62
63 // Starts the worker thread if it isn't already running. 63 // Starts the worker thread if it isn't already running.
64 void EnsureThreadStarted(); 64 void EnsureThreadStarted();
65 65
66 // Starts the next job from |pending_jobs_| if possible. 66 // Starts the next job from |pending_jobs_| if possible.
67 void ProcessPendingJobs(); 67 void ProcessPendingJobs();
68 68
69 // Removes the front entry of the jobs queue. |expected_job| is our 69 // Removes the front entry of the jobs queue. |expected_job| is our
70 // expectation of what the front of the job queue is; it is only used by 70 // expectation of what the front of the job queue is; it is only used by
71 // DCHECK for verification purposes. 71 // DCHECK for verification purposes.
72 void RemoveFrontOfJobsQueueAndStartNext(Job* expected_job); 72 void RemoveFrontOfJobsQueueAndStartNext(Job* expected_job);
73 73
74 // Clears |outstanding_set_pac_script_task_|.
75 // Called when |task| has just finished.
76 void RemoveOutstandingSetPacScriptTask(SetPacScriptTask* task);
77
74 // The synchronous resolver implementation. 78 // The synchronous resolver implementation.
75 scoped_ptr<ProxyResolver> resolver_; 79 scoped_ptr<ProxyResolver> resolver_;
76 80
77 // The thread where |resolver_| is run on. 81 // The thread where |resolver_| is run on.
78 // Note that declaration ordering is important here. |thread_| needs to be 82 // Note that declaration ordering is important here. |thread_| needs to be
79 // destroyed *before* |resolver_|, in case |resolver_| is currently 83 // destroyed *before* |resolver_|, in case |resolver_| is currently
80 // executing on |thread_|. 84 // executing on |thread_|.
81 scoped_ptr<base::Thread> thread_; 85 scoped_ptr<base::Thread> thread_;
82 86
83 PendingJobsQueue pending_jobs_; 87 PendingJobsQueue pending_jobs_;
88 scoped_refptr<SetPacScriptTask> outstanding_set_pac_script_task_;
84 }; 89 };
85 90
86 } // namespace net 91 } // namespace net
87 92
88 #endif // NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_ 93 #endif // NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_service_unittest.cc ('k') | net/proxy/single_threaded_proxy_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698