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

Side by Side Diff: chrome/browser/net/predictor.cc

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | content/browser/browser_main_loop.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/predictor.h" 5 #include "chrome/browser/net/predictor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <sstream> 10 #include <sstream>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/string_split.h" 17 #include "base/string_split.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/stringprintf.h" 19 #include "base/stringprintf.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "base/threading/thread_restrictions.h"
21 #include "base/time.h" 22 #include "base/time.h"
22 #include "base/values.h" 23 #include "base/values.h"
23 #include "chrome/browser/io_thread.h" 24 #include "chrome/browser/io_thread.h"
24 #include "chrome/browser/net/preconnect.h" 25 #include "chrome/browser/net/preconnect.h"
25 #include "chrome/browser/prefs/pref_service.h" 26 #include "chrome/browser/prefs/pref_service.h"
26 #include "chrome/browser/prefs/scoped_user_pref_update.h" 27 #include "chrome/browser/prefs/scoped_user_pref_update.h"
27 #include "chrome/browser/prefs/session_startup_pref.h" 28 #include "chrome/browser/prefs/session_startup_pref.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
30 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 base::Bind( 762 base::Bind(
762 &SaveDnsPrefetchStateForNextStartupAndTrimOnIOThread, 763 &SaveDnsPrefetchStateForNextStartupAndTrimOnIOThread,
763 update_startup_list.Get(), 764 update_startup_list.Get(),
764 update_referral_list.Get(), 765 update_referral_list.Get(),
765 &completion, 766 &completion,
766 this)); 767 this));
767 768
768 // TODO(jar): Synchronous waiting for the IO thread is a potential source 769 // TODO(jar): Synchronous waiting for the IO thread is a potential source
769 // to deadlocks and should be investigated. See http://crbug.com/78451. 770 // to deadlocks and should be investigated. See http://crbug.com/78451.
770 DCHECK(posted); 771 DCHECK(posted);
771 if (posted) 772 if (posted) {
773 // http://crbug.com/124954
774 base::ThreadRestrictions::ScopedAllowWait allow_wait;
772 completion.Wait(); 775 completion.Wait();
776 }
773 } 777 }
774 } 778 }
775 779
776 void Predictor::SaveDnsPrefetchStateForNextStartupAndTrim( 780 void Predictor::SaveDnsPrefetchStateForNextStartupAndTrim(
777 base::ListValue* startup_list, 781 base::ListValue* startup_list,
778 base::ListValue* referral_list, 782 base::ListValue* referral_list,
779 base::WaitableEvent* completion) { 783 base::WaitableEvent* completion) {
780 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 784 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
781 if (initial_observer_.get()) 785 if (initial_observer_.get())
782 initial_observer_->GetInitialDnsResolutionList(startup_list); 786 initial_observer_->GetInitialDnsResolutionList(startup_list);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 IOThread* io_thread, 1176 IOThread* io_thread,
1173 net::URLRequestContextGetter* getter) { 1177 net::URLRequestContextGetter* getter) {
1174 // Empty function for unittests. 1178 // Empty function for unittests.
1175 } 1179 }
1176 1180
1177 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { 1181 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) {
1178 SetShutdown(true); 1182 SetShutdown(true);
1179 } 1183 }
1180 1184
1181 } // namespace chrome_browser_net 1185 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698