Chromium Code Reviews| 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/webdata/web_data_service.h" | 5 #include "chrome/browser/webdata/web_data_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 WebDataService::WebDataService() | 80 WebDataService::WebDataService() |
| 81 : is_running_(false), | 81 : is_running_(false), |
| 82 db_(NULL), | 82 db_(NULL), |
| 83 request_manager_(new WebDataRequestManager()), | 83 request_manager_(new WebDataRequestManager()), |
| 84 app_locale_(AutofillCountry::ApplicationLocale()), | 84 app_locale_(AutofillCountry::ApplicationLocale()), |
| 85 autocomplete_syncable_service_(NULL), | 85 autocomplete_syncable_service_(NULL), |
| 86 autofill_profile_syncable_service_(NULL), | 86 autofill_profile_syncable_service_(NULL), |
| 87 failed_init_(false), | 87 failed_init_(false), |
| 88 should_commit_(false), | 88 should_commit_(false), |
| 89 main_loop_(MessageLoop::current()) { | 89 main_loop_(MessageLoop::current()) { |
| 90 // WebDataService takes ownership of a non-sharable resource (Web Data DB | |
| 91 // file) and so should never be launched on the import process, as it can | |
| 92 // grab the resource before the main browser process does. | |
| 93 CHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())); | |
|
gab
2013/03/07 15:46:57
FWIW, we (me and macourteau) were hitting the DCHE
| |
| 94 | |
| 90 // WebDataService requires DB thread if instantiated. | 95 // WebDataService requires DB thread if instantiated. |
| 91 // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL) | 96 // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL) |
| 92 // if you do not want to instantiate WebDataService in your test. | 97 // if you do not want to instantiate WebDataService in your test. |
| 93 DCHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())); | |
| 94 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB)); | 98 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB)); |
| 95 } | 99 } |
| 96 | 100 |
| 97 // static | 101 // static |
| 98 void WebDataService::NotifyOfMultipleAutofillChanges( | 102 void WebDataService::NotifyOfMultipleAutofillChanges( |
| 99 WebDataService* web_data_service) { | 103 WebDataService* web_data_service) { |
| 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 101 | 105 |
| 102 if (!web_data_service) | 106 if (!web_data_service) |
| 103 return; | 107 return; |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 | 952 |
| 949 void WebDataService::DestroyAutofillCreditCardResult( | 953 void WebDataService::DestroyAutofillCreditCardResult( |
| 950 const WDTypedResult* result) { | 954 const WDTypedResult* result) { |
| 951 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); | 955 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); |
| 952 const WDResult<std::vector<CreditCard*> >* r = | 956 const WDResult<std::vector<CreditCard*> >* r = |
| 953 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); | 957 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); |
| 954 | 958 |
| 955 std::vector<CreditCard*> credit_cards = r->GetValue(); | 959 std::vector<CreditCard*> credit_cards = r->GetValue(); |
| 956 STLDeleteElements(&credit_cards); | 960 STLDeleteElements(&credit_cards); |
| 957 } | 961 } |
| OLD | NEW |