Disambiguate origins of tasks posted by the WebDataService.

When calling PostTask, rather than always providing the source information corresponding to ScheduleTask, use the location of the caller of ScheduleTask. This helps in disambiguating tasks in, for example, the task profiler.


BUG=105921
TEST=

Review URL: http://codereview.chromium.org/8745017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113032 0039d316-1c4b-4281-b951-d872f2087c98
parent 9ae95a7c
...@@ -108,7 +108,8 @@ bool WebDataService::Init(const FilePath& profile_path) { ...@@ -108,7 +108,8 @@ bool WebDataService::Init(const FilePath& profile_path) {
} }
void WebDataService::Shutdown() { void WebDataService::Shutdown() {
ScheduleTask(Bind(&WebDataService::ShutdownSyncableServices, this)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::ShutdownSyncableServices, this));
UnloadDatabase(); UnloadDatabase();
} }
...@@ -117,7 +118,7 @@ bool WebDataService::IsRunning() const { ...@@ -117,7 +118,7 @@ bool WebDataService::IsRunning() const {
} }
void WebDataService::UnloadDatabase() { void WebDataService::UnloadDatabase() {
ScheduleTask(Bind(&WebDataService::ShutdownDatabase, this)); ScheduleTask(FROM_HERE, Bind(&WebDataService::ShutdownDatabase, this));
} }
void WebDataService::CancelRequest(Handle h) { void WebDataService::CancelRequest(Handle h) {
...@@ -152,7 +153,7 @@ void WebDataService::AddKeyword(const TemplateURL& url) { ...@@ -152,7 +153,7 @@ void WebDataService::AddKeyword(const TemplateURL& url) {
GenericRequest<TemplateURL>* request = GenericRequest<TemplateURL>* request =
new GenericRequest<TemplateURL>(this, GetNextRequestHandle(), NULL, url); new GenericRequest<TemplateURL>(this, GetNextRequestHandle(), NULL, url);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddKeywordImpl, this, request)); ScheduleTask(FROM_HERE, Bind(&WebDataService::AddKeywordImpl, this, request));
} }
void WebDataService::RemoveKeyword(const TemplateURL& url) { void WebDataService::RemoveKeyword(const TemplateURL& url) {
...@@ -160,7 +161,8 @@ void WebDataService::RemoveKeyword(const TemplateURL& url) { ...@@ -160,7 +161,8 @@ void WebDataService::RemoveKeyword(const TemplateURL& url) {
new GenericRequest<TemplateURLID>(this, GetNextRequestHandle(), new GenericRequest<TemplateURLID>(this, GetNextRequestHandle(),
NULL, url.id()); NULL, url.id());
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveKeywordImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveKeywordImpl, this, request));
} }
void WebDataService::UpdateKeyword(const TemplateURL& url) { void WebDataService::UpdateKeyword(const TemplateURL& url) {
...@@ -170,7 +172,8 @@ void WebDataService::UpdateKeyword(const TemplateURL& url) { ...@@ -170,7 +172,8 @@ void WebDataService::UpdateKeyword(const TemplateURL& url) {
GenericRequest<TemplateURL>* request = GenericRequest<TemplateURL>* request =
new GenericRequest<TemplateURL>(this, GetNextRequestHandle(), NULL, url); new GenericRequest<TemplateURL>(this, GetNextRequestHandle(), NULL, url);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::UpdateKeywordImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::UpdateKeywordImpl, this, request));
} }
WebDataService::Handle WebDataService::GetKeywords( WebDataService::Handle WebDataService::GetKeywords(
...@@ -178,7 +181,8 @@ WebDataService::Handle WebDataService::GetKeywords( ...@@ -178,7 +181,8 @@ WebDataService::Handle WebDataService::GetKeywords(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetKeywordsImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetKeywordsImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -189,16 +193,16 @@ void WebDataService::SetDefaultSearchProvider(const TemplateURL* url) { ...@@ -189,16 +193,16 @@ void WebDataService::SetDefaultSearchProvider(const TemplateURL* url) {
NULL, NULL,
url ? url->id() : 0); url ? url->id() : 0);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::SetDefaultSearchProviderImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::SetDefaultSearchProviderImpl,
this, request)); this, request));
} }
void WebDataService::SetBuiltinKeywordVersion(int version) { void WebDataService::SetBuiltinKeywordVersion(int version) {
GenericRequest<int>* request = GenericRequest<int>* request =
new GenericRequest<int>(this, GetNextRequestHandle(), NULL, version); new GenericRequest<int>(this, GetNextRequestHandle(), NULL, version);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::SetBuiltinKeywordVersionImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::SetBuiltinKeywordVersionImpl,
this, request)); this, request));
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -213,7 +217,8 @@ void WebDataService::SetWebAppImage(const GURL& app_url, ...@@ -213,7 +217,8 @@ void WebDataService::SetWebAppImage(const GURL& app_url,
new GenericRequest2<GURL, SkBitmap>(this, GetNextRequestHandle(), new GenericRequest2<GURL, SkBitmap>(this, GetNextRequestHandle(),
NULL, app_url, image); NULL, app_url, image);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::SetWebAppImageImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::SetWebAppImageImpl, this, request));
} }
void WebDataService::SetWebAppHasAllImages(const GURL& app_url, void WebDataService::SetWebAppHasAllImages(const GURL& app_url,
...@@ -222,14 +227,16 @@ void WebDataService::SetWebAppHasAllImages(const GURL& app_url, ...@@ -222,14 +227,16 @@ void WebDataService::SetWebAppHasAllImages(const GURL& app_url,
new GenericRequest2<GURL, bool>(this, GetNextRequestHandle(), new GenericRequest2<GURL, bool>(this, GetNextRequestHandle(),
NULL, app_url, has_all_images); NULL, app_url, has_all_images);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::SetWebAppHasAllImagesImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::SetWebAppHasAllImagesImpl, this, request));
} }
void WebDataService::RemoveWebApp(const GURL& app_url) { void WebDataService::RemoveWebApp(const GURL& app_url) {
GenericRequest<GURL>* request = GenericRequest<GURL>* request =
new GenericRequest<GURL>(this, GetNextRequestHandle(), NULL, app_url); new GenericRequest<GURL>(this, GetNextRequestHandle(), NULL, app_url);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveWebAppImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveWebAppImpl, this, request));
} }
WebDataService::Handle WebDataService::GetWebAppImages( WebDataService::Handle WebDataService::GetWebAppImages(
...@@ -238,7 +245,8 @@ WebDataService::Handle WebDataService::GetWebAppImages( ...@@ -238,7 +245,8 @@ WebDataService::Handle WebDataService::GetWebAppImages(
GenericRequest<GURL>* request = GenericRequest<GURL>* request =
new GenericRequest<GURL>(this, GetNextRequestHandle(), consumer, app_url); new GenericRequest<GURL>(this, GetNextRequestHandle(), consumer, app_url);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetWebAppImagesImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetWebAppImagesImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -253,7 +261,8 @@ void WebDataService::AddWebIntentService(const WebIntentServiceData& service) { ...@@ -253,7 +261,8 @@ void WebDataService::AddWebIntentService(const WebIntentServiceData& service) {
new GenericRequest<WebIntentServiceData>( new GenericRequest<WebIntentServiceData>(
this, GetNextRequestHandle(), NULL, service); this, GetNextRequestHandle(), NULL, service);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddWebIntentServiceImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::AddWebIntentServiceImpl, this, request));
} }
void WebDataService::RemoveWebIntentService( void WebDataService::RemoveWebIntentService(
...@@ -262,9 +271,8 @@ void WebDataService::RemoveWebIntentService( ...@@ -262,9 +271,8 @@ void WebDataService::RemoveWebIntentService(
new GenericRequest<WebIntentServiceData>( new GenericRequest<WebIntentServiceData>(
this, GetNextRequestHandle(), NULL, service); this, GetNextRequestHandle(), NULL, service);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveWebIntentServiceImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::RemoveWebIntentServiceImpl,
this, this, request));
request));
} }
WebDataService::Handle WebDataService::GetWebIntentServices( WebDataService::Handle WebDataService::GetWebIntentServices(
...@@ -274,7 +282,8 @@ WebDataService::Handle WebDataService::GetWebIntentServices( ...@@ -274,7 +282,8 @@ WebDataService::Handle WebDataService::GetWebIntentServices(
GenericRequest<string16>* request = new GenericRequest<string16>( GenericRequest<string16>* request = new GenericRequest<string16>(
this, GetNextRequestHandle(), consumer, action); this, GetNextRequestHandle(), consumer, action);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetWebIntentServicesImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetWebIntentServicesImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -285,9 +294,8 @@ WebDataService::Handle WebDataService::GetWebIntentServicesForURL( ...@@ -285,9 +294,8 @@ WebDataService::Handle WebDataService::GetWebIntentServicesForURL(
GenericRequest<string16>* request = new GenericRequest<string16>( GenericRequest<string16>* request = new GenericRequest<string16>(
this, GetNextRequestHandle(), consumer, service_url); this, GetNextRequestHandle(), consumer, service_url);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetWebIntentServicesForURLImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::GetWebIntentServicesForURLImpl,
this, this, request));
request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -298,9 +306,8 @@ WebDataService::Handle WebDataService::GetAllWebIntentServices( ...@@ -298,9 +306,8 @@ WebDataService::Handle WebDataService::GetAllWebIntentServices(
GenericRequest<std::string>* request = new GenericRequest<std::string>( GenericRequest<std::string>* request = new GenericRequest<std::string>(
this, GetNextRequestHandle(), consumer, std::string()); this, GetNextRequestHandle(), consumer, std::string());
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetAllWebIntentServicesImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::GetAllWebIntentServicesImpl,
this, this, request));
request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -316,7 +323,8 @@ void WebDataService::SetTokenForService(const std::string& service, ...@@ -316,7 +323,8 @@ void WebDataService::SetTokenForService(const std::string& service,
new GenericRequest2<std::string, std::string>( new GenericRequest2<std::string, std::string>(
this, GetNextRequestHandle(), NULL, service, token); this, GetNextRequestHandle(), NULL, service, token);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::SetTokenForServiceImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::SetTokenForServiceImpl, this, request));
} }
void WebDataService::RemoveAllTokens() { void WebDataService::RemoveAllTokens() {
...@@ -324,7 +332,8 @@ void WebDataService::RemoveAllTokens() { ...@@ -324,7 +332,8 @@ void WebDataService::RemoveAllTokens() {
new GenericRequest<std::string>( new GenericRequest<std::string>(
this, GetNextRequestHandle(), NULL, std::string()); this, GetNextRequestHandle(), NULL, std::string());
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveAllTokensImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveAllTokensImpl, this, request));
} }
// Null on failure. Success is WDResult<std::string> // Null on failure. Success is WDResult<std::string>
...@@ -335,7 +344,8 @@ WebDataService::Handle WebDataService::GetAllTokens( ...@@ -335,7 +344,8 @@ WebDataService::Handle WebDataService::GetAllTokens(
new GenericRequest<std::string>( new GenericRequest<std::string>(
this, GetNextRequestHandle(), consumer, std::string()); this, GetNextRequestHandle(), consumer, std::string());
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetAllTokensImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetAllTokensImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -350,7 +360,7 @@ void WebDataService::AddLogin(const PasswordForm& form) { ...@@ -350,7 +360,7 @@ void WebDataService::AddLogin(const PasswordForm& form) {
new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), NULL, new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), NULL,
form); form);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddLoginImpl, this, request)); ScheduleTask(FROM_HERE, Bind(&WebDataService::AddLoginImpl, this, request));
} }
void WebDataService::UpdateLogin(const PasswordForm& form) { void WebDataService::UpdateLogin(const PasswordForm& form) {
...@@ -358,7 +368,8 @@ void WebDataService::UpdateLogin(const PasswordForm& form) { ...@@ -358,7 +368,8 @@ void WebDataService::UpdateLogin(const PasswordForm& form) {
new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), new GenericRequest<PasswordForm>(this, GetNextRequestHandle(),
NULL, form); NULL, form);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::UpdateLoginImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::UpdateLoginImpl, this, request));
} }
void WebDataService::RemoveLogin(const PasswordForm& form) { void WebDataService::RemoveLogin(const PasswordForm& form) {
...@@ -366,7 +377,8 @@ void WebDataService::RemoveLogin(const PasswordForm& form) { ...@@ -366,7 +377,8 @@ void WebDataService::RemoveLogin(const PasswordForm& form) {
new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), NULL, new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), NULL,
form); form);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveLoginImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveLoginImpl, this, request));
} }
void WebDataService::RemoveLoginsCreatedBetween(const Time& delete_begin, void WebDataService::RemoveLoginsCreatedBetween(const Time& delete_begin,
...@@ -378,8 +390,8 @@ void WebDataService::RemoveLoginsCreatedBetween(const Time& delete_begin, ...@@ -378,8 +390,8 @@ void WebDataService::RemoveLoginsCreatedBetween(const Time& delete_begin,
delete_begin, delete_begin,
delete_end); delete_end);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveLoginsCreatedBetweenImpl, ScheduleTask(FROM_HERE, Bind(&WebDataService::RemoveLoginsCreatedBetweenImpl,
this, request)); this, request));
} }
void WebDataService::RemoveLoginsCreatedAfter(const Time& delete_begin) { void WebDataService::RemoveLoginsCreatedAfter(const Time& delete_begin) {
...@@ -393,7 +405,7 @@ WebDataService::Handle WebDataService::GetLogins( ...@@ -393,7 +405,7 @@ WebDataService::Handle WebDataService::GetLogins(
new GenericRequest<PasswordForm>(this, GetNextRequestHandle(), new GenericRequest<PasswordForm>(this, GetNextRequestHandle(),
consumer, form); consumer, form);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetLoginsImpl, this, request)); ScheduleTask(FROM_HERE, Bind(&WebDataService::GetLoginsImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -402,7 +414,8 @@ WebDataService::Handle WebDataService::GetAutofillableLogins( ...@@ -402,7 +414,8 @@ WebDataService::Handle WebDataService::GetAutofillableLogins(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetAutofillableLoginsImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetAutofillableLoginsImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -411,7 +424,8 @@ WebDataService::Handle WebDataService::GetBlacklistLogins( ...@@ -411,7 +424,8 @@ WebDataService::Handle WebDataService::GetBlacklistLogins(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetBlacklistLoginsImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetBlacklistLoginsImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -427,7 +441,8 @@ void WebDataService::AddFormFields( ...@@ -427,7 +441,8 @@ void WebDataService::AddFormFields(
new GenericRequest<std::vector<FormField> >( new GenericRequest<std::vector<FormField> >(
this, GetNextRequestHandle(), NULL, fields); this, GetNextRequestHandle(), NULL, fields);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddFormElementsImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::AddFormElementsImpl, this, request));
} }
WebDataService::Handle WebDataService::GetFormValuesForElementName( WebDataService::Handle WebDataService::GetFormValuesForElementName(
...@@ -436,7 +451,8 @@ WebDataService::Handle WebDataService::GetFormValuesForElementName( ...@@ -436,7 +451,8 @@ WebDataService::Handle WebDataService::GetFormValuesForElementName(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetFormValuesForElementNameImpl, ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetFormValuesForElementNameImpl,
this, request, name, prefix, limit)); this, request, name, prefix, limit));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -450,7 +466,8 @@ void WebDataService::RemoveFormElementsAddedBetween(const Time& delete_begin, ...@@ -450,7 +466,8 @@ void WebDataService::RemoveFormElementsAddedBetween(const Time& delete_begin,
delete_begin, delete_begin,
delete_end); delete_end);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveFormElementsAddedBetweenImpl, ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveFormElementsAddedBetweenImpl,
this, request)); this, request));
} }
...@@ -462,7 +479,8 @@ void WebDataService::RemoveFormValueForElementName( ...@@ -462,7 +479,8 @@ void WebDataService::RemoveFormValueForElementName(
NULL, NULL,
name, value); name, value);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveFormValueForElementNameImpl, ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveFormValueForElementNameImpl,
this, request)); this, request));
} }
...@@ -471,7 +489,8 @@ void WebDataService::AddAutofillProfile(const AutofillProfile& profile) { ...@@ -471,7 +489,8 @@ void WebDataService::AddAutofillProfile(const AutofillProfile& profile) {
new GenericRequest<AutofillProfile>( new GenericRequest<AutofillProfile>(
this, GetNextRequestHandle(), NULL, profile); this, GetNextRequestHandle(), NULL, profile);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddAutofillProfileImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::AddAutofillProfileImpl, this, request));
} }
void WebDataService::UpdateAutofillProfile(const AutofillProfile& profile) { void WebDataService::UpdateAutofillProfile(const AutofillProfile& profile) {
...@@ -479,7 +498,8 @@ void WebDataService::UpdateAutofillProfile(const AutofillProfile& profile) { ...@@ -479,7 +498,8 @@ void WebDataService::UpdateAutofillProfile(const AutofillProfile& profile) {
new GenericRequest<AutofillProfile>( new GenericRequest<AutofillProfile>(
this, GetNextRequestHandle(), NULL, profile); this, GetNextRequestHandle(), NULL, profile);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::UpdateAutofillProfileImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::UpdateAutofillProfileImpl, this, request));
} }
void WebDataService::RemoveAutofillProfile(const std::string& guid) { void WebDataService::RemoveAutofillProfile(const std::string& guid) {
...@@ -487,7 +507,8 @@ void WebDataService::RemoveAutofillProfile(const std::string& guid) { ...@@ -487,7 +507,8 @@ void WebDataService::RemoveAutofillProfile(const std::string& guid) {
new GenericRequest<std::string>( new GenericRequest<std::string>(
this, GetNextRequestHandle(), NULL, guid); this, GetNextRequestHandle(), NULL, guid);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveAutofillProfileImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveAutofillProfileImpl, this, request));
} }
WebDataService::Handle WebDataService::GetAutofillProfiles( WebDataService::Handle WebDataService::GetAutofillProfiles(
...@@ -495,7 +516,8 @@ WebDataService::Handle WebDataService::GetAutofillProfiles( ...@@ -495,7 +516,8 @@ WebDataService::Handle WebDataService::GetAutofillProfiles(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetAutofillProfilesImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetAutofillProfilesImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -504,7 +526,8 @@ void WebDataService::EmptyMigrationTrash(bool notify_sync) { ...@@ -504,7 +526,8 @@ void WebDataService::EmptyMigrationTrash(bool notify_sync) {
new GenericRequest<bool>( new GenericRequest<bool>(
this, GetNextRequestHandle(), NULL, notify_sync); this, GetNextRequestHandle(), NULL, notify_sync);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::EmptyMigrationTrashImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::EmptyMigrationTrashImpl, this, request));
} }
void WebDataService::AddCreditCard(const CreditCard& credit_card) { void WebDataService::AddCreditCard(const CreditCard& credit_card) {
...@@ -512,7 +535,8 @@ void WebDataService::AddCreditCard(const CreditCard& credit_card) { ...@@ -512,7 +535,8 @@ void WebDataService::AddCreditCard(const CreditCard& credit_card) {
new GenericRequest<CreditCard>( new GenericRequest<CreditCard>(
this, GetNextRequestHandle(), NULL, credit_card); this, GetNextRequestHandle(), NULL, credit_card);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddCreditCardImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::AddCreditCardImpl, this, request));
} }
void WebDataService::UpdateCreditCard(const CreditCard& credit_card) { void WebDataService::UpdateCreditCard(const CreditCard& credit_card) {
...@@ -520,7 +544,8 @@ void WebDataService::UpdateCreditCard(const CreditCard& credit_card) { ...@@ -520,7 +544,8 @@ void WebDataService::UpdateCreditCard(const CreditCard& credit_card) {
new GenericRequest<CreditCard>( new GenericRequest<CreditCard>(
this, GetNextRequestHandle(), NULL, credit_card); this, GetNextRequestHandle(), NULL, credit_card);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::UpdateCreditCardImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::UpdateCreditCardImpl, this, request));
} }
void WebDataService::RemoveCreditCard(const std::string& guid) { void WebDataService::RemoveCreditCard(const std::string& guid) {
...@@ -528,7 +553,8 @@ void WebDataService::RemoveCreditCard(const std::string& guid) { ...@@ -528,7 +553,8 @@ void WebDataService::RemoveCreditCard(const std::string& guid) {
new GenericRequest<std::string>( new GenericRequest<std::string>(
this, GetNextRequestHandle(), NULL, guid); this, GetNextRequestHandle(), NULL, guid);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveCreditCardImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveCreditCardImpl, this, request));
} }
WebDataService::Handle WebDataService::GetCreditCards( WebDataService::Handle WebDataService::GetCreditCards(
...@@ -536,7 +562,8 @@ WebDataService::Handle WebDataService::GetCreditCards( ...@@ -536,7 +562,8 @@ WebDataService::Handle WebDataService::GetCreditCards(
WebDataRequest* request = WebDataRequest* request =
new WebDataRequest(this, GetNextRequestHandle(), consumer); new WebDataRequest(this, GetNextRequestHandle(), consumer);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetCreditCardsImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetCreditCardsImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
...@@ -550,10 +577,9 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetween( ...@@ -550,10 +577,9 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetween(
delete_begin, delete_begin,
delete_end); delete_end);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind( ScheduleTask(FROM_HERE, Bind(
&WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl, &WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl,
this, this, request));
request));
} }
WebDataService::~WebDataService() { WebDataService::~WebDataService() {
...@@ -572,8 +598,10 @@ bool WebDataService::InitWithPath(const FilePath& path) { ...@@ -572,8 +598,10 @@ bool WebDataService::InitWithPath(const FilePath& path) {
// This should be safe to remove once [ http://crbug.com/100845 ] is fixed. // This should be safe to remove once [ http://crbug.com/100845 ] is fixed.
AutofillCountry::ApplicationLocale(); AutofillCountry::ApplicationLocale();
ScheduleTask(Bind(&WebDataService::InitializeDatabaseIfNecessary, this)); ScheduleTask(FROM_HERE,
ScheduleTask(Bind(&WebDataService::InitializeSyncableServices, this)); Bind(&WebDataService::InitializeDatabaseIfNecessary, this));
ScheduleTask(FROM_HERE,
Bind(&WebDataService::InitializeSyncableServices, this));
return true; return true;
} }
...@@ -711,9 +739,10 @@ void WebDataService::Commit() { ...@@ -711,9 +739,10 @@ void WebDataService::Commit() {
} }
} }
void WebDataService::ScheduleTask(const base::Closure& task) { void WebDataService::ScheduleTask(const tracked_objects::Location& from_here,
const base::Closure& task) {
if (is_running_) if (is_running_)
BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, task); BrowserThread::PostTask(BrowserThread::DB, from_here, task);
else else
NOTREACHED() << "Task scheduled after Shutdown()"; NOTREACHED() << "Task scheduled after Shutdown()";
} }
...@@ -721,7 +750,7 @@ void WebDataService::ScheduleTask(const base::Closure& task) { ...@@ -721,7 +750,7 @@ void WebDataService::ScheduleTask(const base::Closure& task) {
void WebDataService::ScheduleCommit() { void WebDataService::ScheduleCommit() {
if (should_commit_ == false) { if (should_commit_ == false) {
should_commit_ = true; should_commit_ = true;
ScheduleTask(Bind(&WebDataService::Commit, this)); ScheduleTask(FROM_HERE, Bind(&WebDataService::Commit, this));
} }
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/location.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "chrome/browser/search_engines/template_url_id.h" #include "chrome/browser/search_engines/template_url_id.h"
...@@ -592,7 +593,8 @@ class WebDataService ...@@ -592,7 +593,8 @@ class WebDataService
void Commit(); void Commit();
// Schedule a task on our worker thread. // Schedule a task on our worker thread.
void ScheduleTask(const base::Closure& task); void ScheduleTask(const tracked_objects::Location& from_here,
const base::Closure& task);
// Schedule a commit if one is not already pending. // Schedule a commit if one is not already pending.
void ScheduleCommit(); void ScheduleCommit();
......
...@@ -16,7 +16,8 @@ void WebDataService::AddIE7Login(const IE7PasswordInfo& info) { ...@@ -16,7 +16,8 @@ void WebDataService::AddIE7Login(const IE7PasswordInfo& info) {
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL, new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL,
info); info);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::AddIE7LoginImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::AddIE7LoginImpl, this, request));
} }
void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) {
...@@ -24,7 +25,8 @@ void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { ...@@ -24,7 +25,8 @@ void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) {
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL, new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL,
info); info);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::RemoveIE7LoginImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::RemoveIE7LoginImpl, this, request));
} }
WebDataService::Handle WebDataService::GetIE7Login( WebDataService::Handle WebDataService::GetIE7Login(
...@@ -34,7 +36,8 @@ WebDataService::Handle WebDataService::GetIE7Login( ...@@ -34,7 +36,8 @@ WebDataService::Handle WebDataService::GetIE7Login(
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(),
consumer, info); consumer, info);
RegisterRequest(request); RegisterRequest(request);
ScheduleTask(Bind(&WebDataService::GetIE7LoginImpl, this, request)); ScheduleTask(FROM_HERE,
Bind(&WebDataService::GetIE7LoginImpl, this, request));
return request->GetHandle(); return request->GetHandle();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment