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

Unified Diff: net/proxy/multi_threaded_proxy_resolver.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: net/proxy/multi_threaded_proxy_resolver.cc
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index cab22ab275909f96b0c3eb29583fe3e589d87d68..c65ae625faa8222430aae6e964cb4fa50fd10141 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -26,7 +26,7 @@ namespace net {
// thread and a synchronous ProxyResolver (which will be operated on said
// thread.)
class MultiThreadedProxyResolver::Executor
- : public base::RefCountedThreadSafe<MultiThreadedProxyResolver::Executor > {
+ : public base::RefCountedThreadSafe<MultiThreadedProxyResolver::Executor> {
public:
// |coordinator| must remain valid throughout our lifetime. It is used to
// signal when the executor is ready to receive work by calling
@@ -91,24 +91,17 @@ class MultiThreadedProxyResolver::Job
: type_(type),
callback_(callback),
executor_(NULL),
- was_cancelled_(false) {
- }
+ was_cancelled_(false) {}
- void set_executor(Executor* executor) {
- executor_ = executor;
- }
+ void set_executor(Executor* executor) { executor_ = executor; }
// The "executor" is the job runner that is scheduling this job. If
// this job has not been submitted to an executor yet, this will be
// NULL (and we know it hasn't started yet).
- Executor* executor() {
- return executor_;
- }
+ Executor* executor() { return executor_; }
// Mark the job as having been cancelled.
- void Cancel() {
- was_cancelled_ = true;
- }
+ void Cancel() { was_cancelled_ = true; }
// Returns true if Cancel() has been called.
bool was_cancelled() const { return was_cancelled_; }
@@ -169,11 +162,10 @@ class MultiThreadedProxyResolver::SetPacScriptJob
public:
SetPacScriptJob(const scoped_refptr<ProxyResolverScriptData>& script_data,
const CompletionCallback& callback)
- : Job(!callback.is_null() ? TYPE_SET_PAC_SCRIPT :
- TYPE_SET_PAC_SCRIPT_INTERNAL,
- callback),
- script_data_(script_data) {
- }
+ : Job(!callback.is_null() ? TYPE_SET_PAC_SCRIPT
+ : TYPE_SET_PAC_SCRIPT_INTERNAL,
+ callback),
+ script_data_(script_data) {}
// Runs on the worker thread.
virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE {
@@ -182,8 +174,7 @@ class MultiThreadedProxyResolver::SetPacScriptJob
DCHECK_NE(rv, ERR_IO_PENDING);
origin_loop->PostTask(
- FROM_HERE,
- base::Bind(&SetPacScriptJob::RequestComplete, this, rv));
+ FROM_HERE, base::Bind(&SetPacScriptJob::RequestComplete, this, rv));
}
protected:
@@ -251,8 +242,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
DCHECK_NE(rv, ERR_IO_PENDING);
origin_loop->PostTask(
- FROM_HERE,
- base::Bind(&GetProxyForURLJob::QueryComplete, this, rv));
+ FROM_HERE, base::Bind(&GetProxyForURLJob::QueryComplete, this, rv));
}
protected:
@@ -314,8 +304,8 @@ MultiThreadedProxyResolver::Executor::Executor(
DCHECK(coordinator);
DCHECK(resolver);
// Start up the thread.
- thread_.reset(new base::Thread(base::StringPrintf("PAC thread #%d",
- thread_number)));
+ thread_.reset(
+ new base::Thread(base::StringPrintf("PAC thread #%d", thread_number)));
CHECK(thread_->Start());
}
@@ -328,8 +318,7 @@ void MultiThreadedProxyResolver::Executor::StartJob(Job* job) {
job->set_executor(this);
job->FinishedWaitingForThread();
thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&Job::Run, job, base::MessageLoopProxy::current()));
+ FROM_HERE, base::Bind(&Job::Run, job, base::MessageLoopProxy::current()));
}
void MultiThreadedProxyResolver::Executor::OnJobCompleted(Job* job) {
@@ -392,8 +381,11 @@ MultiThreadedProxyResolver::~MultiThreadedProxyResolver() {
}
int MultiThreadedProxyResolver::GetProxyForURL(
- const GURL& url, ProxyInfo* results, const CompletionCallback& callback,
- RequestHandle* request, const BoundNetLog& net_log) {
+ const GURL& url,
+ ProxyInfo* results,
+ const CompletionCallback& callback,
+ RequestHandle* request,
+ const BoundNetLog& net_log) {
DCHECK(CalledOnValidThread());
DCHECK(!callback.is_null());
DCHECK(current_script_data_.get())
@@ -461,8 +453,7 @@ void MultiThreadedProxyResolver::CancelSetPacScript() {
DCHECK(CalledOnValidThread());
DCHECK_EQ(0u, pending_jobs_.size());
DCHECK_EQ(1u, executors_.size());
- DCHECK_EQ(Job::TYPE_SET_PAC_SCRIPT,
- executors_[0]->outstanding_job()->type());
+ DCHECK_EQ(Job::TYPE_SET_PAC_SCRIPT, executors_[0]->outstanding_job()->type());
// Defensively clear some data which shouldn't be getting used
// anymore.
@@ -473,7 +464,7 @@ void MultiThreadedProxyResolver::CancelSetPacScript() {
int MultiThreadedProxyResolver::SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
- const CompletionCallback&callback) {
+ const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK(!callback.is_null());
@@ -499,7 +490,8 @@ void MultiThreadedProxyResolver::CheckNoOutstandingUserRequests() const {
CHECK_EQ(0u, pending_jobs_.size());
for (ExecutorList::const_iterator it = executors_.begin();
- it != executors_.end(); ++it) {
+ it != executors_.end();
+ ++it) {
const Executor* executor = it->get();
Job* job = executor->outstanding_job();
// The "has_user_callback()" is to exclude jobs for which the callback
@@ -514,8 +506,8 @@ void MultiThreadedProxyResolver::CheckNoOutstandingUserRequests() const {
void MultiThreadedProxyResolver::ReleaseAllExecutors() {
DCHECK(CalledOnValidThread());
- for (ExecutorList::iterator it = executors_.begin();
- it != executors_.end(); ++it) {
+ for (ExecutorList::iterator it = executors_.begin(); it != executors_.end();
+ ++it) {
Executor* executor = it->get();
executor->Destroy();
}
@@ -525,8 +517,8 @@ void MultiThreadedProxyResolver::ReleaseAllExecutors() {
MultiThreadedProxyResolver::Executor*
MultiThreadedProxyResolver::FindIdleExecutor() {
DCHECK(CalledOnValidThread());
- for (ExecutorList::iterator it = executors_.begin();
- it != executors_.end(); ++it) {
+ for (ExecutorList::iterator it = executors_.begin(); it != executors_.end();
+ ++it) {
Executor* executor = it->get();
if (!executor->outstanding_job())
return executor;
@@ -541,8 +533,7 @@ MultiThreadedProxyResolver::AddNewExecutor() {
// The "thread number" is used to give the thread a unique name.
int thread_number = executors_.size();
ProxyResolver* resolver = resolver_factory_->CreateProxyResolver();
- Executor* executor = new Executor(
- this, resolver, thread_number);
+ Executor* executor = new Executor(this, resolver, thread_number);
executors_.push_back(make_scoped_refptr(executor));
return executor;
}

Powered by Google App Engine
This is Rietveld 408576698