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

Side by Side Diff: chrome/browser/password_manager/password_store_x.cc

Issue 838453003: Open the LoginDatabase on the DB thread, not the UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits from vabr@. Created 5 years, 11 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 (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/password_manager/password_store_x.h" 5 #include "chrome/browser/password_manager/password_store_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 23 matching lines...) Expand all
34 *changes = backend->AddLogin(form); 34 *changes = backend->AddLogin(form);
35 return (!changes->empty() && 35 return (!changes->empty() &&
36 changes->back().type() == PasswordStoreChange::ADD); 36 changes->back().type() == PasswordStoreChange::ADD);
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 PasswordStoreX::PasswordStoreX( 41 PasswordStoreX::PasswordStoreX(
42 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 42 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 43 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
44 password_manager::LoginDatabase* login_db, 44 scoped_ptr<password_manager::LoginDatabase> login_db,
45 NativeBackend* backend) 45 NativeBackend* backend)
46 : PasswordStoreDefault(main_thread_runner, db_thread_runner, login_db), 46 : PasswordStoreDefault(main_thread_runner,
47 db_thread_runner,
48 login_db.Pass()),
47 backend_(backend), 49 backend_(backend),
48 migration_checked_(!backend), 50 migration_checked_(!backend),
49 allow_fallback_(false) {} 51 allow_fallback_(false) {
52 }
50 53
51 PasswordStoreX::~PasswordStoreX() {} 54 PasswordStoreX::~PasswordStoreX() {}
52 55
53 PasswordStoreChangeList PasswordStoreX::AddLoginImpl(const PasswordForm& form) { 56 PasswordStoreChangeList PasswordStoreX::AddLoginImpl(const PasswordForm& form) {
54 CheckMigration(); 57 CheckMigration();
55 PasswordStoreChangeList changes; 58 PasswordStoreChangeList changes;
56 if (use_native_backend() && AddLoginToBackend(backend_, form, &changes)) { 59 if (use_native_backend() && AddLoginToBackend(backend_, form, &changes)) {
57 allow_fallback_ = false; 60 allow_fallback_ = false;
58 } else if (allow_default_store()) { 61 } else if (allow_default_store()) {
59 changes = PasswordStoreDefault::AddLoginImpl(form); 62 changes = PasswordStoreDefault::AddLoginImpl(form);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // it before deleting the file just in case there is some problem deleting 279 // it before deleting the file just in case there is some problem deleting
277 // the file (e.g. directory is not writable, but file is), which would 280 // the file (e.g. directory is not writable, but file is), which would
278 // otherwise cause passwords to re-migrate next (or maybe every) time. 281 // otherwise cause passwords to re-migrate next (or maybe every) time.
279 DeleteAndRecreateDatabaseFile(); 282 DeleteAndRecreateDatabaseFile();
280 } 283 }
281 } 284 }
282 ssize_t result = ok ? forms.size() : -1; 285 ssize_t result = ok ? forms.size() : -1;
283 STLDeleteElements(&forms); 286 STLDeleteElements(&forms);
284 return result; 287 return result;
285 } 288 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | chrome/browser/password_manager/password_store_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698