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

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

Issue 10252003: ScopedAllowWait for NativeBackendKWallet::InitWithBus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated copyright header Created 8 years, 8 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
« no previous file with comments | « base/threading/thread_restrictions.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 (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/native_backend_kwallet_x.h" 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/pickle.h" 11 #include "base/pickle.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread_restrictions.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "dbus/bus.h" 17 #include "dbus/bus.h"
17 #include "dbus/message.h" 18 #include "dbus/message.h"
18 #include "dbus/object_path.h" 19 #include "dbus/object_path.h"
19 #include "dbus/object_proxy.h" 20 #include "dbus/object_proxy.h"
20 #include "grit/chromium_strings.h" 21 #include "grit/chromium_strings.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 using webkit::forms::PasswordForm; 25 using webkit::forms::PasswordForm;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // succeeds, but later, we'll want to do most work on the DB thread. So we 78 // succeeds, but later, we'll want to do most work on the DB thread. So we
78 // have to do the initialization on the DB thread here too, and wait for it. 79 // have to do the initialization on the DB thread here too, and wait for it.
79 bool success = false; 80 bool success = false;
80 base::WaitableEvent event(false, false); 81 base::WaitableEvent event(false, false);
81 // NativeBackendKWallet isn't reference counted, but we wait for InitWithBus 82 // NativeBackendKWallet isn't reference counted, but we wait for InitWithBus
82 // to finish, so we can safely use base::Unretained here. 83 // to finish, so we can safely use base::Unretained here.
83 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 84 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
84 base::Bind(&NativeBackendKWallet::InitOnDBThread, 85 base::Bind(&NativeBackendKWallet::InitOnDBThread,
85 base::Unretained(this), 86 base::Unretained(this),
86 optional_bus, &event, &success)); 87 optional_bus, &event, &success));
88
89 // This ScopedAllowWait should not be here. http://crbug.com/125331
90 base::ThreadRestrictions::ScopedAllowWait allow_wait;
87 event.Wait(); 91 event.Wait();
88 return success; 92 return success;
89 } 93 }
90 94
91 void NativeBackendKWallet::InitOnDBThread(scoped_refptr<dbus::Bus> optional_bus, 95 void NativeBackendKWallet::InitOnDBThread(scoped_refptr<dbus::Bus> optional_bus,
92 base::WaitableEvent* event, 96 base::WaitableEvent* event,
93 bool* success) { 97 bool* success) {
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 98 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
95 DCHECK(!session_bus_.get()); 99 DCHECK(!session_bus_.get());
96 if (optional_bus.get()) { 100 if (optional_bus.get()) {
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 // Each other profile must be able to migrate the shared data as well, 945 // Each other profile must be able to migrate the shared data as well,
942 // so we must leave it alone. After a few releases, we'll add code to 946 // so we must leave it alone. After a few releases, we'll add code to
943 // delete them, and eventually remove this migration code. 947 // delete them, and eventually remove this migration code.
944 // TODO(mdm): follow through with the plan above. 948 // TODO(mdm): follow through with the plan above.
945 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); 949 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_);
946 } else { 950 } else {
947 // We failed to migrate for some reason. Use the old folder name. 951 // We failed to migrate for some reason. Use the old folder name.
948 folder_name_ = kKWalletFolder; 952 folder_name_ = kKWalletFolder;
949 } 953 }
950 } 954 }
OLDNEW
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698