Chromium Code Reviews| Index: chrome/browser/ui/cocoa/status_bubble_mac.mm |
| diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm |
| index 272cb9d965ff308b42205ce11a12ffa2e5e77d04..e93c9182c1ed8c031b03ac386c71a84fa7364d8a 100644 |
| --- a/chrome/browser/ui/cocoa/status_bubble_mac.mm |
| +++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm |
| @@ -8,6 +8,7 @@ |
| #include "base/bind.h" |
| #include "base/compiler_specific.h" |
| +#include "base/debug/stack_trace.h" |
| #include "base/mac/mac_util.h" |
| #include "base/mac/scoped_block.h" |
| #include "base/mac/sdk_forward_declarations.h" |
| @@ -205,10 +206,18 @@ void StatusBubbleMac::SetURL(const GURL& url, const std::string& languages) { |
| CGFloat bubble_width = NSWidth([window_ frame]); |
| if (state_ == kBubbleHidden) { |
| - DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.width, |
| - [window_ frame].size.width); |
| - DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.height, |
| - [window_ frame].size.height); |
| + // TODO(rohitrao): The window size is expected to be (1,1) whenever the |
| + // window is hidden, but the GPU bots are hitting cases where this is not |
| + // true. Instead of enforcing this invariant with a DCHECK, add logging to |
| + // try and debug it and fix up the window size if needed. crbug.com/464754 |
| + NSRect frame = [window_ frame]; |
| + if (!CGSizeEqualToSize(frame.size, ui::kWindowSizeDeterminedLater.size)) { |
|
erikchen
2015/03/17 18:14:31
You may want to wrap this logic so that it doesn't
erikchen
2015/03/17 18:15:37
I'm referring to the logs messages and stack_trace
|
| + LOG(ERROR) << "Window size should be (1,1), but is instead (" |
| + << frame.size.width << "," << frame.size.height << ")"; |
| + LOG(ERROR) << base::debug::StackTrace().ToString(); |
| + frame.size = ui::kWindowSizeDeterminedLater.size; |
| + [window_ setFrame:frame display:NO]; |
| + } |
| bubble_width = NSWidth(CalculateWindowFrame(/*expand=*/false)); |
| } |
| @@ -759,10 +768,17 @@ void StatusBubbleMac::UpdateSizeAndPosition() { |
| if (state_ == kBubbleHidden) { |
| // Verify that hidden bubbles always have size equal to |
| // ui::kWindowSizeDeterminedLater. |
| - DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.width, |
| - [window_ frame].size.width); |
| - DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.height, |
| - [window_ frame].size.height); |
| + // TODO(rohitrao): The GPU bots are hitting cases where this is not |
| + // true. Instead of enforcing this invariant with a DCHECK, add logging to |
| + // try and debug it and fix up the window size if needed. crbug.com/464754 |
| + NSRect frame = [window_ frame]; |
| + if (!CGSizeEqualToSize(frame.size, ui::kWindowSizeDeterminedLater.size)) { |
| + LOG(ERROR) << "Window size should be (1,1), but is instead (" |
| + << frame.size.width << "," << frame.size.height << ")"; |
| + LOG(ERROR) << base::debug::StackTrace().ToString(); |
| + frame.size = ui::kWindowSizeDeterminedLater.size; |
| + [window_ setFrame:frame display:YES]; |
| + } |
| return; |
| } |