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

Side by Side Diff: components/signin/core/browser/webdata/token_web_data.cc

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signin/core/browser/webdata/token_web_data.h" 5 #include "components/signin/core/browser/webdata/token_web_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_delete_on_message_loop.h" 8 #include "base/memory/ref_counted_delete_on_task_runner.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "components/signin/core/browser/webdata/token_service_table.h" 11 #include "components/signin/core/browser/webdata/token_service_table.h"
12 #include "components/webdata/common/web_database_service.h" 12 #include "components/webdata/common/web_database_service.h"
13 13
14 using base::Bind; 14 using base::Bind;
15 using base::Time; 15 using base::Time;
16 16
17 class TokenWebDataBackend 17 class TokenWebDataBackend
18 : public base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend> { 18 : public base::RefCountedDeleteOnTaskRunner<TokenWebDataBackend> {
19
20 public: 19 public:
21 TokenWebDataBackend(scoped_refptr<base::MessageLoopProxy> db_thread) 20 TokenWebDataBackend(scoped_refptr<base::MessageLoopProxy> db_thread)
22 : base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>(db_thread) { 21 : base::RefCountedDeleteOnTaskRunner<TokenWebDataBackend>(db_thread) {}
23 }
24 22
25 WebDatabase::State RemoveAllTokens(WebDatabase* db) { 23 WebDatabase::State RemoveAllTokens(WebDatabase* db) {
26 if (TokenServiceTable::FromWebDatabase(db)->RemoveAllTokens()) { 24 if (TokenServiceTable::FromWebDatabase(db)->RemoveAllTokens()) {
27 return WebDatabase::COMMIT_NEEDED; 25 return WebDatabase::COMMIT_NEEDED;
28 } 26 }
29 return WebDatabase::COMMIT_NOT_NEEDED; 27 return WebDatabase::COMMIT_NOT_NEEDED;
30 } 28 }
31 29
32 WebDatabase::State RemoveTokenForService( 30 WebDatabase::State RemoveTokenForService(
33 const std::string& service, WebDatabase* db) { 31 const std::string& service, WebDatabase* db) {
(...skipping 18 matching lines...) Expand all
52 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); 50 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map);
53 return scoped_ptr<WDTypedResult>( 51 return scoped_ptr<WDTypedResult>(
54 new WDResult<std::map<std::string, std::string> >(TOKEN_RESULT, map)); 52 new WDResult<std::map<std::string, std::string> >(TOKEN_RESULT, map));
55 } 53 }
56 54
57 protected: 55 protected:
58 virtual ~TokenWebDataBackend() { 56 virtual ~TokenWebDataBackend() {
59 } 57 }
60 58
61 private: 59 private:
62 friend class base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>; 60 friend class base::RefCountedDeleteOnTaskRunner<TokenWebDataBackend>;
63 friend class base::DeleteHelper<TokenWebDataBackend>; 61 friend class base::DeleteHelper<TokenWebDataBackend>;
64 }; 62 };
65 63
66 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs, 64 TokenWebData::TokenWebData(scoped_refptr<WebDatabaseService> wdbs,
67 scoped_refptr<base::MessageLoopProxy> ui_thread, 65 scoped_refptr<base::MessageLoopProxy> ui_thread,
68 scoped_refptr<base::MessageLoopProxy> db_thread, 66 scoped_refptr<base::MessageLoopProxy> db_thread,
69 const ProfileErrorCallback& callback) 67 const ProfileErrorCallback& callback)
70 : WebDataServiceBase(wdbs, callback, ui_thread), 68 : WebDataServiceBase(wdbs, callback, ui_thread),
71 token_backend_(new TokenWebDataBackend(db_thread)) { 69 token_backend_(new TokenWebDataBackend(db_thread)) {
72 } 70 }
(...skipping 24 matching lines...) Expand all
97 } 95 }
98 96
99 TokenWebData::TokenWebData(scoped_refptr<base::MessageLoopProxy> ui_thread, 97 TokenWebData::TokenWebData(scoped_refptr<base::MessageLoopProxy> ui_thread,
100 scoped_refptr<base::MessageLoopProxy> db_thread) 98 scoped_refptr<base::MessageLoopProxy> db_thread)
101 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread), 99 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread),
102 token_backend_(new TokenWebDataBackend(db_thread)) { 100 token_backend_(new TokenWebDataBackend(db_thread)) {
103 } 101 }
104 102
105 TokenWebData::~TokenWebData() { 103 TokenWebData::~TokenWebData() {
106 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698