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

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

Issue 1115113002: Adding DCHECK for CurrentlyOn(BrowserThread::IO) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 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
« 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) 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>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 proxy_service_(NULL), 153 proxy_service_(NULL),
154 preconnect_enabled_(preconnect_enabled), 154 preconnect_enabled_(preconnect_enabled),
155 consecutive_omnibox_preconnect_count_(0), 155 consecutive_omnibox_preconnect_count_(0),
156 next_trim_time_(base::TimeTicks::Now() + 156 next_trim_time_(base::TimeTicks::Now() +
157 TimeDelta::FromHours(kDurationBetweenTrimmingsHours)), 157 TimeDelta::FromHours(kDurationBetweenTrimmingsHours)),
158 observer_(NULL) { 158 observer_(NULL) {
159 DCHECK_CURRENTLY_ON(BrowserThread::UI); 159 DCHECK_CURRENTLY_ON(BrowserThread::UI);
160 } 160 }
161 161
162 Predictor::~Predictor() { 162 Predictor::~Predictor() {
163 // TODO(rlp): Add DCHECK for CurrentlyOn(BrowserThread::IO) when the 163 DCHECK_CURRENTLY_ON(BrowserThread::IO);
164 // ProfileManagerTest has been updated with a mock profile.
165 DCHECK(shutdown_); 164 DCHECK(shutdown_);
166 } 165 }
167 166
168 // static 167 // static
169 Predictor* Predictor::CreatePredictor(bool preconnect_enabled, 168 Predictor* Predictor::CreatePredictor(bool preconnect_enabled,
170 bool predictor_enabled, 169 bool predictor_enabled,
171 bool simple_shutdown) { 170 bool simple_shutdown) {
172 if (simple_shutdown) 171 if (simple_shutdown)
173 return new SimplePredictor(preconnect_enabled, predictor_enabled); 172 return new SimplePredictor(preconnect_enabled, predictor_enabled);
174 return new Predictor(preconnect_enabled, predictor_enabled); 173 return new Predictor(preconnect_enabled, predictor_enabled);
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1316 }
1318 1317
1319 void SimplePredictor::ShutdownOnUIThread() { 1318 void SimplePredictor::ShutdownOnUIThread() {
1320 SetShutdown(true); 1319 SetShutdown(true);
1321 } 1320 }
1322 1321
1323 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } 1322 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; }
1324 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } 1323 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; }
1325 1324
1326 } // namespace chrome_browser_net 1325 } // namespace chrome_browser_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