OLD | NEW |
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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/leak_tracker.h" | 7 #include "base/leak_tracker.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 chrome_browser_net::EnablePredictor(prefetching_enabled); | 330 chrome_browser_net::EnablePredictor(prefetching_enabled); |
331 | 331 |
332 predictor_ = new chrome_browser_net::Predictor( | 332 predictor_ = new chrome_browser_net::Predictor( |
333 globals_->host_resolver, | 333 globals_->host_resolver, |
334 max_dns_queue_delay, | 334 max_dns_queue_delay, |
335 max_concurrent, | 335 max_concurrent, |
336 preconnect_enabled); | 336 preconnect_enabled); |
337 predictor_->AddRef(); | 337 predictor_->AddRef(); |
338 | 338 |
339 // TODO(jar): Until connection notification and DNS observation handling are | 339 // Speculative_interceptor_ is used to predict subresource usage. |
340 // properly combined into a learning model, we'll only use one observation | 340 DCHECK(!speculative_interceptor_); |
341 // mechanism or the other. | 341 speculative_interceptor_ = new chrome_browser_net::ConnectInterceptor; |
342 if (preconnect_enabled) { | 342 |
343 DCHECK(!speculative_interceptor_); | 343 // TODO(jar): We can completely replace prefetch_observer with |
344 speculative_interceptor_ = new chrome_browser_net::ConnectInterceptor; | 344 // speculative_interceptor. |
345 } else { | 345 // Prefetch_observer is used to monitor initial resolutions. |
346 DCHECK(!prefetch_observer_); | 346 DCHECK(!prefetch_observer_); |
347 prefetch_observer_ = chrome_browser_net::CreateResolverObserver(); | 347 prefetch_observer_ = chrome_browser_net::CreateResolverObserver(); |
348 globals_->host_resolver->AddObserver(prefetch_observer_); | 348 globals_->host_resolver->AddObserver(prefetch_observer_); |
349 } | |
350 | 349 |
351 FinalizePredictorInitialization( | 350 FinalizePredictorInitialization( |
352 predictor_, prefetch_observer_, startup_urls, referral_list); | 351 predictor_, prefetch_observer_, startup_urls, referral_list); |
353 } | 352 } |
354 | 353 |
355 void IOThread::ChangedToOnTheRecordOnIOThread() { | 354 void IOThread::ChangedToOnTheRecordOnIOThread() { |
356 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 355 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
357 | 356 |
358 if (predictor_) { | 357 if (predictor_) { |
359 // Destroy all evidence of our OTR session. | 358 // Destroy all evidence of our OTR session. |
360 predictor_->Predictor::DiscardAllResults(); | 359 predictor_->Predictor::DiscardAllResults(); |
361 } | 360 } |
362 | 361 |
363 // Clear the host cache to avoid showing entries from the OTR session | 362 // Clear the host cache to avoid showing entries from the OTR session |
364 // in about:net-internals. | 363 // in about:net-internals. |
365 if (globals_->host_resolver->GetAsHostResolverImpl()) { | 364 if (globals_->host_resolver->GetAsHostResolverImpl()) { |
366 net::HostCache* host_cache = | 365 net::HostCache* host_cache = |
367 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 366 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
368 if (host_cache) | 367 if (host_cache) |
369 host_cache->clear(); | 368 host_cache->clear(); |
370 } | 369 } |
371 // Clear all of the passively logged data. | 370 // Clear all of the passively logged data. |
372 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 371 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
373 // clear the data pertaining to off the record context. | 372 // clear the data pertaining to off the record context. |
374 globals_->net_log->passive_collector()->Clear(); | 373 globals_->net_log->passive_collector()->Clear(); |
375 } | 374 } |
OLD | NEW |