diff options
author | mohan.reddy <mohan.reddy@samsung.com> | 2014-09-10 20:53:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-11 03:59:03 +0000 |
commit | 945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73 (patch) | |
tree | 592d2cb399f0c0c1dddaf2b752fecbcbb4091ca9 /chromeos | |
parent | a4eb244baaac411fe27fb2282e62a80ee20fe1ff (diff) | |
download | chromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.zip chromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.tar.gz chromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.tar.bz2 |
Changing the order of initialization WeakPtrFactory
Changing in the intialization order of WeakPtrFactory such that all
member variables should appear before the WeakPtrFactory to ensure
that any WeakPtrs to Controller are invalidated before its members
variable's destructors are executed, rendering them invalid.
BUG=303818
Review URL: https://codereview.chromium.org/552323003
Cr-Commit-Position: refs/heads/master@{#294319}
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/audio/cras_audio_handler.cc | 4 | ||||
-rw-r--r-- | chromeos/audio/cras_audio_handler.h | 3 | ||||
-rw-r--r-- | chromeos/login/auth/online_attempt.cc | 4 | ||||
-rw-r--r-- | chromeos/login/auth/online_attempt.h | 6 | ||||
-rw-r--r-- | chromeos/tpm_password_fetcher.cc | 2 | ||||
-rw-r--r-- | chromeos/tpm_password_fetcher.h | 3 |
6 files changed, 12 insertions, 10 deletions
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc index 295f280..1907190 100644 --- a/chromeos/audio/cras_audio_handler.cc +++ b/chromeos/audio/cras_audio_handler.cc @@ -327,7 +327,6 @@ void CrasAudioHandler::LogErrors() { CrasAudioHandler::CrasAudioHandler( scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler) : audio_pref_handler_(audio_pref_handler), - weak_ptr_factory_(this), output_mute_on_(false), input_mute_on_(false), output_volume_(0), @@ -338,7 +337,8 @@ CrasAudioHandler::CrasAudioHandler( has_alternative_output_(false), output_mute_locked_(false), input_mute_locked_(false), - log_errors_(false) { + log_errors_(false), + weak_ptr_factory_(this) { if (!audio_pref_handler.get()) return; // If the DBusThreadManager or the CrasAudioClient aren't available, there diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h index 9935963..92850b1 100644 --- a/chromeos/audio/cras_audio_handler.h +++ b/chromeos/audio/cras_audio_handler.h @@ -255,7 +255,6 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, AudioDevice GetSanitizedAudioDevice(const AudioNode& node); scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler_; - base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; ObserverList<AudioObserver> observers_; // Audio data and state. @@ -279,6 +278,8 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, // Failures are not logged at startup, since CRAS may not be running yet. bool log_errors_; + base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); }; diff --git a/chromeos/login/auth/online_attempt.cc b/chromeos/login/auth/online_attempt.cc index fc728f6..6d950a4 100644 --- a/chromeos/login/auth/online_attempt.cc +++ b/chromeos/login/auth/online_attempt.cc @@ -34,8 +34,8 @@ OnlineAttempt::OnlineAttempt(AuthAttemptState* current_attempt, : message_loop_(base::MessageLoopProxy::current()), attempt_(current_attempt), resolver_(callback), - weak_factory_(this), - try_again_(true) { + try_again_(true), + weak_factory_(this) { DCHECK(attempt_->user_type == user_manager::USER_TYPE_REGULAR); } diff --git a/chromeos/login/auth/online_attempt.h b/chromeos/login/auth/online_attempt.h index c91d064..251fe0a 100644 --- a/chromeos/login/auth/online_attempt.h +++ b/chromeos/login/auth/online_attempt.h @@ -68,12 +68,12 @@ class CHROMEOS_EXPORT OnlineAttempt : public GaiaAuthConsumer { // Handles ClientLogin communications with Gaia. scoped_ptr<GaiaAuthFetcher> client_fetcher_; - // Used to cancel the CancelClientLogin closure. - base::WeakPtrFactory<OnlineAttempt> weak_factory_; - // Whether we're willing to re-try the ClientLogin attempt. bool try_again_; + // Used to cancel the CancelClientLogin closure. + base::WeakPtrFactory<OnlineAttempt> weak_factory_; + friend class OnlineAttemptTest; DISALLOW_COPY_AND_ASSIGN(OnlineAttempt); }; diff --git a/chromeos/tpm_password_fetcher.cc b/chromeos/tpm_password_fetcher.cc index e8da91d..02c4abc 100644 --- a/chromeos/tpm_password_fetcher.cc +++ b/chromeos/tpm_password_fetcher.cc @@ -20,7 +20,7 @@ const int kTpmCheckIntervalMs = 500; } // namespace TpmPasswordFetcher::TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate) - : weak_factory_(this), delegate_(delegate) { + : delegate_(delegate), weak_factory_(this) { DCHECK(delegate_); } diff --git a/chromeos/tpm_password_fetcher.h b/chromeos/tpm_password_fetcher.h index f92454c..71a4fc2 100644 --- a/chromeos/tpm_password_fetcher.h +++ b/chromeos/tpm_password_fetcher.h @@ -45,9 +45,10 @@ class CHROMEOS_EXPORT TpmPasswordFetcher { // Posts a task to call Fetch() later. void RescheduleFetch(); - base::WeakPtrFactory<TpmPasswordFetcher> weak_factory_; TpmPasswordFetcherDelegate* delegate_; + base::WeakPtrFactory<TpmPasswordFetcher> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(TpmPasswordFetcher); }; |