Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_gnome_x.h" | 5 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gnome-keyring.h> | 8 #include <gnome-keyring.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 | 375 |
| 376 GnomeKeyringResult GKRMethod::WaitResult() { | 376 GnomeKeyringResult GKRMethod::WaitResult() { |
| 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 378 event_.Wait(); | 378 event_.Wait(); |
| 379 return result_; | 379 return result_; |
| 380 } | 380 } |
| 381 | 381 |
| 382 GnomeKeyringResult GKRMethod::WaitResult(PasswordFormList* forms) { | 382 GnomeKeyringResult GKRMethod::WaitResult(PasswordFormList* forms) { |
| 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 384 event_.Wait(); | 384 event_.Wait(); |
| 385 forms->swap(forms_); | 385 if (forms->empty()) { |
| 386 // Normal case. Avoid extra allocation by swapping. | |
| 387 forms->swap(forms_); | |
|
Evan Martin
2011/08/23 14:36:07
Is this performance critical? I wonder if it's wo
Mike Mammarella
2011/08/23 19:40:20
No, it's not performance critical. It would probab
| |
| 388 } else { | |
| 389 // Rare case. Append forms_ to *forms. | |
| 390 forms->insert(forms->end(), forms_.begin(), forms_.end()); | |
| 391 forms_.clear(); | |
| 392 } | |
| 386 return result_; | 393 return result_; |
| 387 } | 394 } |
| 388 | 395 |
| 389 // static | 396 // static |
| 390 void GKRMethod::OnOperationDone(GnomeKeyringResult result, gpointer data) { | 397 void GKRMethod::OnOperationDone(GnomeKeyringResult result, gpointer data) { |
| 391 GKRMethod* method = static_cast<GKRMethod*>(data); | 398 GKRMethod* method = static_cast<GKRMethod*>(data); |
| 392 method->result_ = result; | 399 method->result_ = result; |
| 393 method->event_.Signal(); | 400 method->event_.Signal(); |
| 394 } | 401 } |
| 395 | 402 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 727 // Each other profile must be able to migrate the shared data as well, | 734 // Each other profile must be able to migrate the shared data as well, |
| 728 // so we must leave it alone. After a few releases, we'll add code to | 735 // so we must leave it alone. After a few releases, we'll add code to |
| 729 // delete them, and eventually remove this migration code. | 736 // delete them, and eventually remove this migration code. |
| 730 // TODO(mdm): follow through with the plan above. | 737 // TODO(mdm): follow through with the plan above. |
| 731 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); | 738 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); |
| 732 } else { | 739 } else { |
| 733 // We failed to migrate for some reason. Use the old app string. | 740 // We failed to migrate for some reason. Use the old app string. |
| 734 app_string_ = kGnomeKeyringAppString; | 741 app_string_ = kGnomeKeyringAppString; |
| 735 } | 742 } |
| 736 } | 743 } |
| OLD | NEW |