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

Side by Side Diff: net/proxy/multi_threaded_proxy_resolver.cc

Issue 6295005: Suppress a ThreadAssertion warning when joining worker thread for PAC scripts... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/proxy/multi_threaded_proxy_resolver.h" 5 #include "net/proxy/multi_threaded_proxy_resolver.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/threading/thread_restrictions.h"
11 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
12 #include "net/base/net_log.h" 13 #include "net/base/net_log.h"
13 #include "net/proxy/proxy_info.h" 14 #include "net/proxy/proxy_info.h"
14 15
15 // TODO(eroman): Have the MultiThreadedProxyResolver clear its PAC script 16 // TODO(eroman): Have the MultiThreadedProxyResolver clear its PAC script
16 // data when SetPacScript fails. That will reclaim memory when 17 // data when SetPacScript fails. That will reclaim memory when
17 // testing bogus scripts. 18 // testing bogus scripts.
18 19
19 namespace net { 20 namespace net {
20 21
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 330 }
330 331
331 void MultiThreadedProxyResolver::Executor::Destroy() { 332 void MultiThreadedProxyResolver::Executor::Destroy() {
332 DCHECK(coordinator_); 333 DCHECK(coordinator_);
333 334
334 // Give the resolver an opportunity to shutdown from THIS THREAD before 335 // Give the resolver an opportunity to shutdown from THIS THREAD before
335 // joining on the resolver thread. This allows certain implementations 336 // joining on the resolver thread. This allows certain implementations
336 // to avoid deadlocks. 337 // to avoid deadlocks.
337 resolver_->Shutdown(); 338 resolver_->Shutdown();
338 339
339 // Join the worker thread. 340 {
340 thread_.reset(); 341 // See http://crbug.com/69710.
342 base::ThreadRestrictions::ScopedAllowIO allow_io;
343
344 // Join the worker thread.
345 thread_.reset();
346 }
341 347
342 // Cancel any outstanding job. 348 // Cancel any outstanding job.
343 if (outstanding_job_) { 349 if (outstanding_job_) {
344 outstanding_job_->Cancel(); 350 outstanding_job_->Cancel();
345 // Orphan the job (since this executor may be deleted soon). 351 // Orphan the job (since this executor may be deleted soon).
346 outstanding_job_->set_executor(NULL); 352 outstanding_job_->set_executor(NULL);
347 } 353 }
348 354
349 // It is now safe to free the ProxyResolver, since all the tasks that 355 // It is now safe to free the ProxyResolver, since all the tasks that
350 // were using it on the resolver thread have completed. 356 // were using it on the resolver thread have completed.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return; 561 return;
556 562
557 // Get the next job to process (FIFO). Transfer it from the pending queue 563 // Get the next job to process (FIFO). Transfer it from the pending queue
558 // to the executor. 564 // to the executor.
559 scoped_refptr<Job> job = pending_jobs_.front(); 565 scoped_refptr<Job> job = pending_jobs_.front();
560 pending_jobs_.pop_front(); 566 pending_jobs_.pop_front();
561 executor->StartJob(job); 567 executor->StartJob(job);
562 } 568 }
563 569
564 } // namespace net 570 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698