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

Side by Side Diff: components/webdata/common/web_data_service_base.cc

Issue 13898011: Move SupportsUserData code into AutofillWebData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and test fix Created 7 years, 7 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
« no previous file with comments | « components/webdata/common/web_data_service_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/webdata/common/web_data_service_base.h" 5 #include "components/webdata/common/web_data_service_base.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 27 matching lines...) Expand all
38 db_loaded_ = true; 38 db_loaded_ = true;
39 } 39 }
40 40
41 void WebDataServiceBase::WebDatabaseLoadFailed(sql::InitStatus status) { 41 void WebDataServiceBase::WebDatabaseLoadFailed(sql::InitStatus status) {
42 if (!profile_error_callback_.is_null()) 42 if (!profile_error_callback_.is_null())
43 profile_error_callback_.Run(status); 43 profile_error_callback_.Run(status);
44 } 44 }
45 45
46 void WebDataServiceBase::ShutdownOnUIThread() { 46 void WebDataServiceBase::ShutdownOnUIThread() {
47 db_loaded_ = false; 47 db_loaded_ = false;
48 BrowserThread::PostTask(
49 BrowserThread::DB, FROM_HERE,
50 base::Bind(&WebDataServiceBase::ShutdownOnDBThread, this));
51 } 48 }
52 49
53 void WebDataServiceBase::Init() { 50 void WebDataServiceBase::Init() {
54 DCHECK(wdbs_.get()); 51 DCHECK(wdbs_.get());
55 wdbs_->AddObserver(this); 52 wdbs_->AddObserver(this);
56 wdbs_->LoadDatabase(); 53 wdbs_->LoadDatabase();
57 } 54 }
58 55
59 void WebDataServiceBase::UnloadDatabase() { 56 void WebDataServiceBase::UnloadDatabase() {
60 if (!wdbs_) 57 if (!wdbs_)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return; 90 return;
94 wdbs_->RemoveObserver(observer); 91 wdbs_->RemoveObserver(observer);
95 } 92 }
96 93
97 WebDatabase* WebDataServiceBase::GetDatabase() { 94 WebDatabase* WebDataServiceBase::GetDatabase() {
98 if (!wdbs_) 95 if (!wdbs_)
99 return NULL; 96 return NULL;
100 return wdbs_->GetDatabaseOnDB(); 97 return wdbs_->GetDatabaseOnDB();
101 } 98 }
102 99
103 base::SupportsUserData* WebDataServiceBase::GetDBUserData() { 100 WebDataServiceBase::~WebDataServiceBase() {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
105 if (!db_thread_user_data_)
106 db_thread_user_data_.reset(new SupportsUserDataAggregatable());
107 return db_thread_user_data_.get();
108 } 101 }
109
110 WebDataServiceBase::~WebDataServiceBase() {
111 DCHECK(!db_thread_user_data_.get()) << "Forgot to call ShutdownOnUIThread?";
112 }
113
114 void WebDataServiceBase::ShutdownOnDBThread() {
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
116 db_thread_user_data_.reset();
117 }
OLDNEW
« no previous file with comments | « components/webdata/common/web_data_service_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698