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

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

Issue 2591963004: Transform RefCountedDeleteOnMessageLoop to RefCountedDeleteOnSequence. (Closed)
Patch Set: similarity Created 3 years, 12 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
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/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted_delete_on_message_loop.h" 9 #include "base/memory/ref_counted_delete_on_sequence.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "components/signin/core/browser/webdata/token_service_table.h" 12 #include "components/signin/core/browser/webdata/token_service_table.h"
13 #include "components/webdata/common/web_database_service.h" 13 #include "components/webdata/common/web_database_service.h"
14 14
15 using base::Bind; 15 using base::Bind;
16 using base::Time; 16 using base::Time;
17 17
18 class TokenWebDataBackend 18 class TokenWebDataBackend
19 : public base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend> { 19 : public base::RefCountedDeleteOnSequence<TokenWebDataBackend> {
20
21 public: 20 public:
22 TokenWebDataBackend(scoped_refptr<base::SingleThreadTaskRunner> db_thread) 21 TokenWebDataBackend(scoped_refptr<base::SingleThreadTaskRunner> db_thread)
23 : base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>(db_thread) {} 22 : base::RefCountedDeleteOnSequence<TokenWebDataBackend>(db_thread) {}
24 23
25 WebDatabase::State RemoveAllTokens(WebDatabase* db) { 24 WebDatabase::State RemoveAllTokens(WebDatabase* db) {
26 if (TokenServiceTable::FromWebDatabase(db)->RemoveAllTokens()) { 25 if (TokenServiceTable::FromWebDatabase(db)->RemoveAllTokens()) {
27 return WebDatabase::COMMIT_NEEDED; 26 return WebDatabase::COMMIT_NEEDED;
28 } 27 }
29 return WebDatabase::COMMIT_NOT_NEEDED; 28 return WebDatabase::COMMIT_NOT_NEEDED;
30 } 29 }
31 30
32 WebDatabase::State RemoveTokenForService( 31 WebDatabase::State RemoveTokenForService(
33 const std::string& service, WebDatabase* db) { 32 const std::string& service, WebDatabase* db) {
(...skipping 18 matching lines...) Expand all
52 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); 51 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map);
53 return base::MakeUnique<WDResult<std::map<std::string, std::string>>>( 52 return base::MakeUnique<WDResult<std::map<std::string, std::string>>>(
54 TOKEN_RESULT, map); 53 TOKEN_RESULT, map);
55 } 54 }
56 55
57 protected: 56 protected:
58 virtual ~TokenWebDataBackend() { 57 virtual ~TokenWebDataBackend() {
59 } 58 }
60 59
61 private: 60 private:
62 friend class base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>; 61 friend class base::RefCountedDeleteOnSequence<TokenWebDataBackend>;
63 friend class base::DeleteHelper<TokenWebDataBackend>; 62 friend class base::DeleteHelper<TokenWebDataBackend>;
64 }; 63 };
65 64
66 TokenWebData::TokenWebData( 65 TokenWebData::TokenWebData(
67 scoped_refptr<WebDatabaseService> wdbs, 66 scoped_refptr<WebDatabaseService> wdbs,
68 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, 67 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
69 scoped_refptr<base::SingleThreadTaskRunner> db_thread, 68 scoped_refptr<base::SingleThreadTaskRunner> db_thread,
70 const ProfileErrorCallback& callback) 69 const ProfileErrorCallback& callback)
71 : WebDataServiceBase(wdbs, callback, ui_thread), 70 : WebDataServiceBase(wdbs, callback, ui_thread),
72 token_backend_(new TokenWebDataBackend(db_thread)) { 71 token_backend_(new TokenWebDataBackend(db_thread)) {
(...skipping 26 matching lines...) Expand all
99 98
100 TokenWebData::TokenWebData( 99 TokenWebData::TokenWebData(
101 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, 100 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
102 scoped_refptr<base::SingleThreadTaskRunner> db_thread) 101 scoped_refptr<base::SingleThreadTaskRunner> db_thread)
103 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread), 102 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread),
104 token_backend_(new TokenWebDataBackend(db_thread)) { 103 token_backend_(new TokenWebDataBackend(db_thread)) {
105 } 104 }
106 105
107 TokenWebData::~TokenWebData() { 106 TokenWebData::~TokenWebData() {
108 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698