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

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

Issue 8355025: Fix an Autofill crash caused by accessing the g_browser_process on the DB thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more tests? Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "chrome/browser/autofill/autofill_country.h"
11 #include "chrome/browser/autofill/autofill_profile.h" 12 #include "chrome/browser/autofill/autofill_profile.h"
12 #include "chrome/browser/autofill/credit_card.h" 13 #include "chrome/browser/autofill/credit_card.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/search_engines/template_url.h" 15 #include "chrome/browser/search_engines/template_url.h"
15 #include "chrome/browser/ui/profile_error_dialog.h" 16 #include "chrome/browser/ui/profile_error_dialog.h"
16 #include "chrome/browser/webdata/autofill_change.h" 17 #include "chrome/browser/webdata/autofill_change.h"
17 #include "chrome/browser/webdata/autofill_entry.h" 18 #include "chrome/browser/webdata/autofill_entry.h"
18 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" 19 #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
19 #include "chrome/browser/webdata/autofill_table.h" 20 #include "chrome/browser/webdata/autofill_table.h"
20 #include "chrome/browser/webdata/keyword_table.h" 21 #include "chrome/browser/webdata/keyword_table.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 534
534 WebDataService::~WebDataService() { 535 WebDataService::~WebDataService() {
535 if (is_running_ && db_) { 536 if (is_running_ && db_) {
536 DLOG_ASSERT("WebDataService dtor called without Shutdown"); 537 DLOG_ASSERT("WebDataService dtor called without Shutdown");
537 } 538 }
538 } 539 }
539 540
540 bool WebDataService::InitWithPath(const FilePath& path) { 541 bool WebDataService::InitWithPath(const FilePath& path) {
541 path_ = path; 542 path_ = path;
542 is_running_ = true; 543 is_running_ = true;
544
545 // TODO(isherman): For now, to avoid a data race on shutdown
546 // [ http://crbug.com/100745 ], call |AutofillCountry::ApplicationLocale()| to
547 // cache the application locale before we try to access it on the DB thread.
548 // This should be safe to remove once [ http://crbug.com/100845 ] is fixed.
549 AutofillCountry::ApplicationLocale();
550
543 ScheduleTask(Bind(&WebDataService::InitializeDatabaseIfNecessary, this)); 551 ScheduleTask(Bind(&WebDataService::InitializeDatabaseIfNecessary, this));
544 ScheduleTask(Bind(&WebDataService::InitializeSyncableServices, this)); 552 ScheduleTask(Bind(&WebDataService::InitializeSyncableServices, this));
545 return true; 553 return true;
546 } 554 }
547 555
548 void WebDataService::RequestCompleted(Handle h) { 556 void WebDataService::RequestCompleted(Handle h) {
549 pending_lock_.Acquire(); 557 pending_lock_.Acquire();
550 RequestMap::iterator i = pending_requests_.find(h); 558 RequestMap::iterator i = pending_requests_.find(h);
551 if (i == pending_requests_.end()) { 559 if (i == pending_requests_.end()) {
552 NOTREACHED() << "Request completed called for an unknown request"; 560 NOTREACHED() << "Request completed called for an unknown request";
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 } 1439 }
1432 1440
1433 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const { 1441 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const {
1434 return result_; 1442 return result_;
1435 } 1443 }
1436 1444
1437 void WebDataService::WebDataRequest::RequestComplete() { 1445 void WebDataService::WebDataRequest::RequestComplete() {
1438 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted, 1446 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted,
1439 service_.get(), handle_)); 1447 service_.get(), handle_));
1440 } 1448 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/phone_number_unittest.cc ('k') | chrome/browser/webdata/web_database_migration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698