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

Side by Side Diff: chromeos/tpm_password_fetcher.cc

Issue 552323003: Changing the order of initialization WeakPtrFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « chromeos/tpm_password_fetcher.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 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 "tpm_password_fetcher.h" 5 #include "tpm_password_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chromeos/dbus/cryptohome_client.h" 10 #include "chromeos/dbus/cryptohome_client.h"
11 #include "chromeos/dbus/dbus_thread_manager.h" 11 #include "chromeos/dbus/dbus_thread_manager.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 namespace { 15 namespace {
16 16
17 // Interval between TPM password checks. 17 // Interval between TPM password checks.
18 const int kTpmCheckIntervalMs = 500; 18 const int kTpmCheckIntervalMs = 500;
19 19
20 } // namespace 20 } // namespace
21 21
22 TpmPasswordFetcher::TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate) 22 TpmPasswordFetcher::TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate)
23 : weak_factory_(this), delegate_(delegate) { 23 : delegate_(delegate), weak_factory_(this) {
24 DCHECK(delegate_); 24 DCHECK(delegate_);
25 } 25 }
26 26
27 TpmPasswordFetcher::~TpmPasswordFetcher() { 27 TpmPasswordFetcher::~TpmPasswordFetcher() {
28 } 28 }
29 29
30 void TpmPasswordFetcher::Fetch() { 30 void TpmPasswordFetcher::Fetch() {
31 // Since this method is also called directly. 31 // Since this method is also called directly.
32 weak_factory_.InvalidateWeakPtrs(); 32 weak_factory_.InvalidateWeakPtrs();
33 33
(...skipping 29 matching lines...) Expand all
63 } 63 }
64 64
65 void TpmPasswordFetcher::RescheduleFetch() { 65 void TpmPasswordFetcher::RescheduleFetch() {
66 base::MessageLoop::current()->PostDelayedTask( 66 base::MessageLoop::current()->PostDelayedTask(
67 FROM_HERE, 67 FROM_HERE,
68 base::Bind(&TpmPasswordFetcher::Fetch, weak_factory_.GetWeakPtr()), 68 base::Bind(&TpmPasswordFetcher::Fetch, weak_factory_.GetWeakPtr()),
69 base::TimeDelta::FromMilliseconds(kTpmCheckIntervalMs)); 69 base::TimeDelta::FromMilliseconds(kTpmCheckIntervalMs));
70 } 70 }
71 71
72 } // namespace chromeos 72 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/tpm_password_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698