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

Unified Diff: net/proxy/single_threaded_proxy_resolver.h

Issue 2822043: Add the capability to run multiple proxy PAC scripts in parallel.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Re-upload after revert Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/proxy/single_threaded_proxy_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/single_threaded_proxy_resolver.h
===================================================================
--- net/proxy/single_threaded_proxy_resolver.h (revision 51914)
+++ net/proxy/single_threaded_proxy_resolver.h (working copy)
@@ -1,94 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
-#define NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
-
-#include <deque>
-#include <string>
-
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "net/proxy/proxy_resolver.h"
-
-namespace base {
-class Thread;
-} // namespace base
-
-namespace net {
-
-// ProxyResolver implementation that wraps a synchronous ProxyResolver, and
-// runs it on a single worker thread. If multiple requests accumulate, they
-// are serviced in FIFO order.
-class SingleThreadedProxyResolver : public ProxyResolver {
- public:
- // |resolver| is a synchronous ProxyResolver implementation. It doesn't
- // have to be thread-safe, since it is run on exactly one thread. The
- // constructor takes ownership of |resolver|.
- explicit SingleThreadedProxyResolver(ProxyResolver* resolver);
-
- virtual ~SingleThreadedProxyResolver();
-
- // ProxyResolver implementation:
- virtual int GetProxyForURL(const GURL& url,
- ProxyInfo* results,
- CompletionCallback* callback,
- RequestHandle* request,
- const BoundNetLog& net_log);
- virtual void CancelRequest(RequestHandle request);
- virtual void CancelSetPacScript();
- virtual void PurgeMemory();
-
- protected:
- // The wrapped (synchronous) ProxyResolver.
- ProxyResolver* resolver() { return resolver_.get(); }
-
- private:
- // Refcounted helper class that bridges between origin thread and worker
- // thread.
- class Job;
- friend class Job;
- class SetPacScriptTask;
- friend class SetPacScriptTask;
- // FIFO queue that contains the in-progress job, and any pending jobs.
- typedef std::deque<scoped_refptr<Job> > PendingJobsQueue;
-
- base::Thread* thread() { return thread_.get(); }
-
- // ProxyResolver implementation:
- virtual int SetPacScript(const GURL& pac_url,
- const string16& pac_script,
- CompletionCallback* callback);
-
- // Starts the worker thread if it isn't already running.
- void EnsureThreadStarted();
-
- // Starts the next job from |pending_jobs_| if possible.
- void ProcessPendingJobs();
-
- // Removes the front entry of the jobs queue. |expected_job| is our
- // expectation of what the front of the job queue is; it is only used by
- // DCHECK for verification purposes.
- void RemoveFrontOfJobsQueueAndStartNext(Job* expected_job);
-
- // Clears |outstanding_set_pac_script_task_|.
- // Called when |task| has just finished.
- void RemoveOutstandingSetPacScriptTask(SetPacScriptTask* task);
-
- // The synchronous resolver implementation.
- scoped_ptr<ProxyResolver> resolver_;
-
- // The thread where |resolver_| is run on.
- // Note that declaration ordering is important here. |thread_| needs to be
- // destroyed *before* |resolver_|, in case |resolver_| is currently
- // executing on |thread_|.
- scoped_ptr<base::Thread> thread_;
-
- PendingJobsQueue pending_jobs_;
- scoped_refptr<SetPacScriptTask> outstanding_set_pac_script_task_;
-};
-
-} // namespace net
-
-#endif // NET_PROXY_SINGLE_THREADED_PROXY_RESOLVER_H_
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/proxy/single_threaded_proxy_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698