Commit 014fd0a1 authored by rohitrao's avatar rohitrao Committed by Commit bot

Relaxes window size DCHECKs in StatusBubbleMac.

These DCHECKs are firing in telemetry tests on the GPU bots.  Removes the
DCHECKs and instead adds debug logging to help track down the root cause.

Since the window size invariants are not holding in some situations, this CL
also contains code to fixup the window size if it is wrong.

BUG=464754
TEST=None

Review URL: https://codereview.chromium.org/1018693003

Cr-Commit-Position: refs/heads/master@{#321000}
parent 458e06bf
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/debug/stack_trace.h"
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/mac/scoped_block.h" #include "base/mac/scoped_block.h"
#include "base/mac/sdk_forward_declarations.h" #include "base/mac/sdk_forward_declarations.h"
...@@ -205,10 +206,19 @@ void StatusBubbleMac::SetURL(const GURL& url, const std::string& languages) { ...@@ -205,10 +206,19 @@ void StatusBubbleMac::SetURL(const GURL& url, const std::string& languages) {
CGFloat bubble_width = NSWidth([window_ frame]); CGFloat bubble_width = NSWidth([window_ frame]);
if (state_ == kBubbleHidden) { if (state_ == kBubbleHidden) {
DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.width, // TODO(rohitrao): The window size is expected to be (1,1) whenever the
[window_ frame].size.width); // window is hidden, but the GPU bots are hitting cases where this is not
DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.height, // true. Instead of enforcing this invariant with a DCHECK, add temporary
[window_ frame].size.height); // logging to try and debug it and fix up the window size if needed.
// This logging is temporary and should be removed: crbug.com/467998
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:NO];
}
bubble_width = NSWidth(CalculateWindowFrame(/*expand=*/false)); bubble_width = NSWidth(CalculateWindowFrame(/*expand=*/false));
} }
...@@ -759,10 +769,19 @@ void StatusBubbleMac::UpdateSizeAndPosition() { ...@@ -759,10 +769,19 @@ void StatusBubbleMac::UpdateSizeAndPosition() {
if (state_ == kBubbleHidden) { if (state_ == kBubbleHidden) {
// Verify that hidden bubbles always have size equal to // Verify that hidden bubbles always have size equal to
// ui::kWindowSizeDeterminedLater. // ui::kWindowSizeDeterminedLater.
DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.width,
[window_ frame].size.width); // TODO(rohitrao): The GPU bots are hitting cases where this is not true.
DCHECK_EQ(ui::kWindowSizeDeterminedLater.size.height, // Instead of enforcing this invariant with a DCHECK, add temporary logging
[window_ frame].size.height); // to try and debug it and fix up the window size if needed.
// This logging is temporary and should be removed: crbug.com/467998
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; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment