| OLD | NEW |
| 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" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 // that blocks the caller, yet allows other messages through. For this reason | 671 // that blocks the caller, yet allows other messages through. For this reason |
| 672 // we only set db_ to the created database if creation is successful. That | 672 // we only set db_ to the created database if creation is successful. That |
| 673 // way other methods won't do anything as db_ is still NULL. | 673 // way other methods won't do anything as db_ is still NULL. |
| 674 WebDatabase* db = new WebDatabase(); | 674 WebDatabase* db = new WebDatabase(); |
| 675 sql::InitStatus init_status = db->Init(path_); | 675 sql::InitStatus init_status = db->Init(path_); |
| 676 if (init_status != sql::INIT_OK) { | 676 if (init_status != sql::INIT_OK) { |
| 677 LOG(ERROR) << "Cannot initialize the web database: " << init_status; | 677 LOG(ERROR) << "Cannot initialize the web database: " << init_status; |
| 678 failed_init_ = true; | 678 failed_init_ = true; |
| 679 delete db; | 679 delete db; |
| 680 if (main_loop_) { | 680 if (main_loop_) { |
| 681 main_loop_->PostTask(FROM_HERE, | 681 main_loop_->PostTask( |
| 682 NewRunnableMethod(this, &WebDataService::DBInitFailed, init_status)); | 682 FROM_HERE, |
| 683 base::Bind(&WebDataService::DBInitFailed, this, init_status)); |
| 683 } | 684 } |
| 684 return; | 685 return; |
| 685 } | 686 } |
| 686 | 687 |
| 687 BrowserThread::PostTask( | 688 BrowserThread::PostTask( |
| 688 BrowserThread::UI, FROM_HERE, | 689 BrowserThread::UI, FROM_HERE, |
| 689 NewRunnableMethod(this, &WebDataService::NotifyDatabaseLoadedOnUIThread)); | 690 base::Bind(&WebDataService::NotifyDatabaseLoadedOnUIThread, this)); |
| 690 | 691 |
| 691 db_ = db; | 692 db_ = db; |
| 692 db_->BeginTransaction(); | 693 db_->BeginTransaction(); |
| 693 } | 694 } |
| 694 | 695 |
| 695 void WebDataService::InitializeSyncableServices() { | 696 void WebDataService::InitializeSyncableServices() { |
| 696 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 697 DCHECK(!autocomplete_syncable_service_); | 698 DCHECK(!autocomplete_syncable_service_); |
| 698 DCHECK(!autofill_profile_syncable_service_); | 699 DCHECK(!autofill_profile_syncable_service_); |
| 699 | 700 |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 } | 1527 } |
| 1527 | 1528 |
| 1528 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const { | 1529 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const { |
| 1529 return result_; | 1530 return result_; |
| 1530 } | 1531 } |
| 1531 | 1532 |
| 1532 void WebDataService::WebDataRequest::RequestComplete() { | 1533 void WebDataService::WebDataRequest::RequestComplete() { |
| 1533 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted, | 1534 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted, |
| 1534 service_.get(), handle_)); | 1535 service_.get(), handle_)); |
| 1535 } | 1536 } |
| OLD | NEW |