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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_webdata_service.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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
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/autofill/core/browser/webdata/autofill_webdata_service.h" 5 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 11 #include "base/stl_util.h"
11 #include "components/autofill/core/browser/autofill_country.h" 12 #include "components/autofill/core/browser/autofill_country.h"
12 #include "components/autofill/core/browser/autofill_profile.h" 13 #include "components/autofill/core/browser/autofill_profile.h"
13 #include "components/autofill/core/browser/credit_card.h" 14 #include "components/autofill/core/browser/credit_card.h"
14 #include "components/autofill/core/browser/webdata/autofill_change.h" 15 #include "components/autofill/core/browser/webdata/autofill_change.h"
15 #include "components/autofill/core/browser/webdata/autofill_entry.h" 16 #include "components/autofill/core/browser/webdata/autofill_entry.h"
16 #include "components/autofill/core/browser/webdata/autofill_table.h" 17 #include "components/autofill/core/browser/webdata/autofill_table.h"
17 #include "components/autofill/core/browser/webdata/autofill_webdata_backend_impl .h" 18 #include "components/autofill/core/browser/webdata/autofill_webdata_backend_impl .h"
18 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h" 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h"
19 #include "components/autofill/core/common/form_field_data.h" 20 #include "components/autofill/core/common/form_field_data.h"
20 #include "components/webdata/common/web_database_backend.h" 21 #include "components/webdata/common/web_database_backend.h"
21 #include "components/webdata/common/web_database_service.h" 22 #include "components/webdata/common/web_database_service.h"
22 23
23 using base::Bind; 24 using base::Bind;
24 using base::Time; 25 using base::Time;
25 26
26 namespace autofill { 27 namespace autofill {
27 28
28 AutofillWebDataService::AutofillWebDataService( 29 AutofillWebDataService::AutofillWebDataService(
29 scoped_refptr<WebDatabaseService> wdbs, 30 scoped_refptr<WebDatabaseService> wdbs,
30 scoped_refptr<base::MessageLoopProxy> ui_thread, 31 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
31 scoped_refptr<base::MessageLoopProxy> db_thread, 32 scoped_refptr<base::SingleThreadTaskRunner> db_thread,
32 const ProfileErrorCallback& callback) 33 const ProfileErrorCallback& callback)
33 : WebDataServiceBase(wdbs, callback, ui_thread), 34 : WebDataServiceBase(wdbs, callback, ui_thread),
34 ui_thread_(ui_thread), 35 ui_thread_(ui_thread),
35 db_thread_(db_thread), 36 db_thread_(db_thread),
36 autofill_backend_(NULL), 37 autofill_backend_(NULL),
37 weak_ptr_factory_(this) { 38 weak_ptr_factory_(this) {
38
39 base::Closure on_changed_callback = Bind( 39 base::Closure on_changed_callback = Bind(
40 &AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread, 40 &AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread,
41 weak_ptr_factory_.GetWeakPtr()); 41 weak_ptr_factory_.GetWeakPtr());
42 42
43 autofill_backend_ = new AutofillWebDataBackendImpl( 43 autofill_backend_ = new AutofillWebDataBackendImpl(
44 wdbs_->GetBackend(), ui_thread_, db_thread_, on_changed_callback); 44 wdbs_->GetBackend(), ui_thread_, db_thread_, on_changed_callback);
45 } 45 }
46 46
47 AutofillWebDataService::AutofillWebDataService( 47 AutofillWebDataService::AutofillWebDataService(
48 scoped_refptr<base::MessageLoopProxy> ui_thread, 48 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
49 scoped_refptr<base::MessageLoopProxy> db_thread) 49 scoped_refptr<base::SingleThreadTaskRunner> db_thread)
50 : WebDataServiceBase(NULL, WebDataServiceBase::ProfileErrorCallback(), 50 : WebDataServiceBase(NULL,
51 ui_thread), 51 WebDataServiceBase::ProfileErrorCallback(),
52 ui_thread),
52 ui_thread_(ui_thread), 53 ui_thread_(ui_thread),
53 db_thread_(db_thread), 54 db_thread_(db_thread),
54 autofill_backend_(new AutofillWebDataBackendImpl(NULL, 55 autofill_backend_(new AutofillWebDataBackendImpl(NULL,
55 ui_thread_, 56 ui_thread_,
56 db_thread_, 57 db_thread_,
57 base::Closure())), 58 base::Closure())),
58 weak_ptr_factory_(this) { 59 weak_ptr_factory_(this) {
59 } 60 }
60 61
61 void AutofillWebDataService::ShutdownOnUIThread() { 62 void AutofillWebDataService::ShutdownOnUIThread() {
62 weak_ptr_factory_.InvalidateWeakPtrs(); 63 weak_ptr_factory_.InvalidateWeakPtrs();
63 db_thread_->PostTask(FROM_HERE, 64 db_thread_->PostTask(FROM_HERE,
64 Bind(&AutofillWebDataBackendImpl::ResetUserData, autofill_backend_)); 65 Bind(&AutofillWebDataBackendImpl::ResetUserData, autofill_backend_));
65 WebDataServiceBase::ShutdownOnUIThread(); 66 WebDataServiceBase::ShutdownOnUIThread();
66 } 67 }
67 68
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 279 }
279 280
280 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() { 281 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() {
281 DCHECK(ui_thread_->BelongsToCurrentThread()); 282 DCHECK(ui_thread_->BelongsToCurrentThread());
282 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread, 283 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread,
283 ui_observer_list_, 284 ui_observer_list_,
284 AutofillMultipleChanged()); 285 AutofillMultipleChanged());
285 } 286 }
286 287
287 } // namespace autofill 288 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698