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

Side by Side Diff: chrome/browser/webdata/web_data_service.cc

Issue 12330073: Disable ProfileKeyedServices on import process by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to ToT Created 7 years, 9 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
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/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
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 should not be instantiated on the ImportProcess, because
91 // the Web Data file cannot be shared, and opening it will cause the main
92 // process to fail to open the profile.
93 CHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess()));
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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 902
899 void WebDataService::DestroyAutofillCreditCardResult( 903 void WebDataService::DestroyAutofillCreditCardResult(
900 const WDTypedResult* result) { 904 const WDTypedResult* result) {
901 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); 905 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT);
902 const WDResult<std::vector<CreditCard*> >* r = 906 const WDResult<std::vector<CreditCard*> >* r =
903 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); 907 static_cast<const WDResult<std::vector<CreditCard*> >*>(result);
904 908
905 std::vector<CreditCard*> credit_cards = r->GetValue(); 909 std::vector<CreditCard*> credit_cards = r->GetValue();
906 STLDeleteElements(&credit_cards); 910 STLDeleteElements(&credit_cards);
907 } 911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698