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

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

Issue 12853004: Move creation of WebDatabaseTable subclasses to WebDatabaseServiceFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to parent and head. 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/api/webdata/web_data_service_base.h" 5 #include "chrome/browser/api/webdata/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 28 matching lines...) Expand all
39 } 39 }
40 40
41 void WebDataServiceBase::ShutdownOnUIThread() { 41 void WebDataServiceBase::ShutdownOnUIThread() {
42 db_loaded_ = false; 42 db_loaded_ = false;
43 BrowserThread::PostTask( 43 BrowserThread::PostTask(
44 BrowserThread::DB, FROM_HERE, 44 BrowserThread::DB, FROM_HERE,
45 base::Bind(&WebDataServiceBase::ShutdownOnDBThread, this)); 45 base::Bind(&WebDataServiceBase::ShutdownOnDBThread, this));
46 ShutdownDatabase(); 46 ShutdownDatabase();
47 } 47 }
48 48
49 void WebDataServiceBase::AddTable(scoped_ptr<WebDatabaseTable> table) {
50 if (!wdbs_.get())
51 wdbs_.reset(new WebDatabaseService(path));
Cait (Slow) 2013/03/21 00:01:56 I think we can just add a temporary |path_| member
52 wdbs_->AddTable(table.Pass());
53 }
54
49 void WebDataServiceBase::Init(const base::FilePath& path) { 55 void WebDataServiceBase::Init(const base::FilePath& path) {
50 wdbs_.reset(new WebDatabaseService(path)); 56 DCHECK(wdbs_.get());
51 wdbs_->LoadDatabase(Bind(&WebDataServiceBase::DatabaseInitOnDB, this)); 57 wdbs_->LoadDatabase(Bind(&WebDataServiceBase::DatabaseInitOnDB, this));
52 } 58 }
53 59
54 void WebDataServiceBase::UnloadDatabase() { 60 void WebDataServiceBase::UnloadDatabase() {
55 if (!wdbs_) 61 if (!wdbs_)
56 return; 62 return;
57 wdbs_->UnloadDatabase(); 63 wdbs_->UnloadDatabase();
58 } 64 }
59 65
60 void WebDataServiceBase::ShutdownDatabase() { 66 void WebDataServiceBase::ShutdownDatabase() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 BrowserThread::PostTask( 131 BrowserThread::PostTask(
126 BrowserThread::UI, FROM_HERE, 132 BrowserThread::UI, FROM_HERE,
127 base::Bind(&WebDataServiceBase::NotifyDatabaseLoadedOnUIThread, this)); 133 base::Bind(&WebDataServiceBase::NotifyDatabaseLoadedOnUIThread, this));
128 } else { 134 } else {
129 BrowserThread::PostTask( 135 BrowserThread::PostTask(
130 BrowserThread::UI, FROM_HERE, 136 BrowserThread::UI, FROM_HERE,
131 base::Bind(&WebDataServiceBase::DBInitFailed, this, status)); 137 base::Bind(&WebDataServiceBase::DBInitFailed, this, status));
132 } 138 }
133 } 139 }
134 140
OLDNEW
« no previous file with comments | « chrome/browser/api/webdata/web_data_service_base.h ('k') | chrome/browser/webdata/web_data_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698