| OLD | NEW |
| 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/safe_browsing/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // |system_url_request_context_getter| may be NULL during tests. | 636 // |system_url_request_context_getter| may be NULL during tests. |
| 637 if (system_url_request_context_getter) | 637 if (system_url_request_context_getter) |
| 638 url_request_context_->CopyFrom( | 638 url_request_context_->CopyFrom( |
| 639 system_url_request_context_getter->GetURLRequestContext()); | 639 system_url_request_context_getter->GetURLRequestContext()); |
| 640 url_request_context_->set_cookie_store(cookie_store); | 640 url_request_context_->set_cookie_store(cookie_store); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void SafeBrowsingService::DestroyURLRequestContextOnIOThread() { | 643 void SafeBrowsingService::DestroyURLRequestContextOnIOThread() { |
| 644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 645 | 645 |
| 646 url_request_context_->AssertNoURLRequests(); |
| 647 |
| 646 // Need to do the CheckForLeaks on IOThread instead of in ShutDown where | 648 // Need to do the CheckForLeaks on IOThread instead of in ShutDown where |
| 647 // url_request_context_getter_ is cleared, since the URLRequestContextGetter | 649 // url_request_context_getter_ is cleared, since the URLRequestContextGetter |
| 648 // will PostTask to IOTread to delete itself. | 650 // will PostTask to IOTread to delete itself. |
| 649 using base::debug::LeakTracker; | 651 using base::debug::LeakTracker; |
| 650 LeakTracker<SafeBrowsingURLRequestContextGetter>::CheckForLeaks(); | 652 LeakTracker<SafeBrowsingURLRequestContextGetter>::CheckForLeaks(); |
| 651 | 653 |
| 652 DCHECK(url_request_context_.get()); | 654 DCHECK(url_request_context_.get()); |
| 653 url_request_context_ = NULL; | 655 url_request_context_ = NULL; |
| 654 } | 656 } |
| 655 | 657 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 Stop(); | 1462 Stop(); |
| 1461 | 1463 |
| 1462 if (csd_service_.get()) | 1464 if (csd_service_.get()) |
| 1463 csd_service_->SetEnabledAndRefreshState(enable); | 1465 csd_service_->SetEnabledAndRefreshState(enable); |
| 1464 if (download_service_.get()) { | 1466 if (download_service_.get()) { |
| 1465 download_service_->SetEnabled( | 1467 download_service_->SetEnabled( |
| 1466 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 1468 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
| 1467 switches::kDisableImprovedDownloadProtection)); | 1469 switches::kDisableImprovedDownloadProtection)); |
| 1468 } | 1470 } |
| 1469 } | 1471 } |
| OLD | NEW |