diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 20:08:18 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 20:08:18 +0000 |
commit | 52163ca4d021094b295f7b51bf005a77bad33eb6 (patch) | |
tree | 9bca93b7032b8d2fc603fc0addfc036ff484a072 /chrome | |
parent | 983a1da3308b3a4605afdf09c301a01c635004e7 (diff) | |
download | chromium_src-52163ca4d021094b295f7b51bf005a77bad33eb6.zip chromium_src-52163ca4d021094b295f7b51bf005a77bad33eb6.tar.gz chromium_src-52163ca4d021094b295f7b51bf005a77bad33eb6.tar.bz2 |
"Am I on the right thread?" DCHECKs for StatusBubbleMac.
This doesn't fix bug 26979, but I want to get these DCHECKs in as I continue
to investigate that bug.
BUG=26979
TEST=don't hit these DCHECKs
Review URL: http://codereview.chromium.org/385043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31695 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/status_bubble_mac.mm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm index 9e718a3..9305100 100644 --- a/chrome/browser/cocoa/status_bubble_mac.mm +++ b/chrome/browser/cocoa/status_bubble_mac.mm @@ -343,6 +343,7 @@ void StatusBubbleMac::Attach() { } void StatusBubbleMac::AnimationDidStop(CAAnimation* animation, bool finished) { + DCHECK([NSThread isMainThread]); DCHECK(state_ == kBubbleShowingFadeIn || state_ == kBubbleHidingFadeOut); if (finished) { @@ -352,10 +353,10 @@ void StatusBubbleMac::AnimationDidStop(CAAnimation* animation, bool finished) { // properly synchronized. if (state_ == kBubbleShowingFadeIn) { DCHECK_EQ([[window_ animator] alphaValue], kBubbleOpacity); - state_ = kBubbleShown; + SetState(kBubbleShown); } else { DCHECK_EQ([[window_ animator] alphaValue], 0.0); - state_ = kBubbleHidden; + SetState(kBubbleHidden); } } } @@ -371,6 +372,8 @@ void StatusBubbleMac::SetState(StatusBubbleState state) { } void StatusBubbleMac::Fade(bool show) { + DCHECK([NSThread isMainThread]); + StatusBubbleState fade_state = kBubbleShowingFadeIn; StatusBubbleState target_state = kBubbleShown; NSTimeInterval full_duration = kShowFadeInDurationSeconds; @@ -414,6 +417,7 @@ void StatusBubbleMac::Fade(bool show) { } void StatusBubbleMac::StartTimer(int64 delay_ms) { + DCHECK([NSThread isMainThread]); DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); if (immediate_) { @@ -431,12 +435,15 @@ void StatusBubbleMac::StartTimer(int64 delay_ms) { } void StatusBubbleMac::CancelTimer() { + DCHECK([NSThread isMainThread]); + if (!timer_factory_.empty()) timer_factory_.RevokeAll(); } void StatusBubbleMac::TimerFired() { DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); + DCHECK([NSThread isMainThread]); if (state_ == kBubbleShowingTimer) { SetState(kBubbleShowingFadeIn); |