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

Side by Side Diff: ash/common/shelf/wm_shelf.cc

Issue 2549833002: Adds tracing to investigate infinite calls to SetAutoHideBehavior (Closed)
Patch Set: Adds tracing to investigate infinite calls to SetAutoHideBehavior (nits) Created 4 years 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 | « ash/common/shelf/wm_shelf.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/shelf/wm_shelf.h" 5 #include "ash/common/shelf/wm_shelf.h"
6 6
7 #include "ash/common/shelf/shelf_controller.h" 7 #include "ash/common/shelf/shelf_controller.h"
8 #include "ash/common/shelf/shelf_delegate.h" 8 #include "ash/common/shelf/shelf_delegate.h"
9 #include "ash/common/shelf/shelf_item_delegate.h" 9 #include "ash/common/shelf/shelf_item_delegate.h"
10 #include "ash/common/shelf/shelf_layout_manager.h" 10 #include "ash/common/shelf/shelf_layout_manager.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return bottom; 159 return bottom;
160 } 160 }
161 161
162 int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const { 162 int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const {
163 return IsHorizontalAlignment() ? horizontal : vertical; 163 return IsHorizontalAlignment() ? horizontal : vertical;
164 } 164 }
165 165
166 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) { 166 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) {
167 DCHECK(shelf_layout_manager_); 167 DCHECK(shelf_layout_manager_);
168 168
169 // Force a stack dump when this method is invoked too frequently.
170 // This block is here temporary to help investigate http://crbug.com/665093 .
171 constexpr int kAutoHideRepeatInterval = 10000;
172 constexpr int kMaxAutoHideChangesIn10Seconds = 100;
173 if ((base::TimeTicks::Now() - time_last_auto_hide_change_).InMilliseconds() <
174 kAutoHideRepeatInterval) {
175 if (++count_auto_hide_changes_ > kMaxAutoHideChangesIn10Seconds)
176 CHECK(false);
177 } else {
178 count_auto_hide_changes_ = 0;
179 }
180 time_last_auto_hide_change_ = base::TimeTicks::Now();
181
169 if (auto_hide_behavior_ == auto_hide_behavior) 182 if (auto_hide_behavior_ == auto_hide_behavior)
170 return; 183 return;
171 184
172 auto_hide_behavior_ = auto_hide_behavior; 185 auto_hide_behavior_ = auto_hide_behavior;
173 WmShell::Get()->shelf_controller()->NotifyShelfAutoHideBehaviorChanged(this); 186 WmShell::Get()->shelf_controller()->NotifyShelfAutoHideBehaviorChanged(this);
174 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged( 187 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged(
175 GetWindow()->GetRootWindow()); 188 GetWindow()->GetRootWindow());
176 } 189 }
177 190
178 ShelfAutoHideState WmShelf::GetAutoHideState() const { 191 ShelfAutoHideState WmShelf::GetAutoHideState() const {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 339
327 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, 340 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type,
328 BackgroundAnimatorChangeType change_type) { 341 BackgroundAnimatorChangeType change_type) {
329 if (background_type == GetBackgroundType()) 342 if (background_type == GetBackgroundType())
330 return; 343 return;
331 for (auto& observer : observers_) 344 for (auto& observer : observers_)
332 observer.OnBackgroundTypeChanged(background_type, change_type); 345 observer.OnBackgroundTypeChanged(background_type, change_type);
333 } 346 }
334 347
335 } // namespace ash 348 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/wm_shelf.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698