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

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

Issue 16938006: Adds RefCountedDeleteOnMessageLoop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the gyp file Created 7 years, 6 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
« no previous file with comments | « components/webdata/common/web_database_service.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_database_service.h" 5 #include "components/webdata/common/web_database_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "components/webdata/common/web_data_request_manager.h" 9 #include "components/webdata/common/web_data_request_manager.h"
10 #include "components/webdata/common/web_data_results.h" 10 #include "components/webdata/common/web_data_results.h"
(...skipping 20 matching lines...) Expand all
31 FROM_HERE, 31 FROM_HERE,
32 base::Bind(&WebDatabaseService::OnDatabaseLoadDone, 32 base::Bind(&WebDatabaseService::OnDatabaseLoadDone,
33 web_database_service_, 33 web_database_service_,
34 status)); 34 status));
35 } 35 }
36 private: 36 private:
37 const base::WeakPtr<WebDatabaseService> web_database_service_; 37 const base::WeakPtr<WebDatabaseService> web_database_service_;
38 }; 38 };
39 39
40 WebDatabaseService::WebDatabaseService( 40 WebDatabaseService::WebDatabaseService(
41 const base::FilePath& path) 41 const base::FilePath& path,
42 : path_(path), 42 const scoped_refptr<base::MessageLoopProxy>& ui_thread)
43 : base::RefCountedDeleteOnMessageLoop<WebDatabaseService>(ui_thread),
44 path_(path),
43 weak_ptr_factory_(this), 45 weak_ptr_factory_(this),
44 db_loaded_(false) { 46 db_loaded_(false) {
45 // WebDatabaseService should be instantiated on UI thread. 47 // WebDatabaseService should be instantiated on UI thread.
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 48 DCHECK(ui_thread->BelongsToCurrentThread());
47 // WebDatabaseService requires DB thread if instantiated. 49 // WebDatabaseService requires DB thread if instantiated.
48 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB)); 50 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB));
49 } 51 }
50 52
51 WebDatabaseService::~WebDatabaseService() { 53 WebDatabaseService::~WebDatabaseService() {
52 } 54 }
53 55
54 void WebDatabaseService::AddTable(scoped_ptr<WebDatabaseTable> table) { 56 void WebDatabaseService::AddTable(scoped_ptr<WebDatabaseTable> table) {
55 if (!wds_backend_.get()) { 57 if (!wds_backend_.get()) {
56 wds_backend_ = new WebDataServiceBackend( 58 wds_backend_ = new WebDataServiceBackend(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } else { 170 } else {
169 // Notify that the database load failed. 171 // Notify that the database load failed.
170 for (size_t i = 0; i < error_callbacks_.size(); i++) { 172 for (size_t i = 0; i < error_callbacks_.size(); i++) {
171 if (!error_callbacks_[i].is_null()) 173 if (!error_callbacks_[i].is_null())
172 error_callbacks_[i].Run(status); 174 error_callbacks_[i].Run(status);
173 } 175 }
174 176
175 error_callbacks_.clear(); 177 error_callbacks_.clear();
176 } 178 }
177 } 179 }
OLDNEW
« no previous file with comments | « components/webdata/common/web_database_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698