Commit c7b4bab8 authored by sky@chromium.org's avatar sky@chromium.org

Adds some debugging code to figure out why we crash when showing the

omnibox in some cases. I suspect the call to the IME code is
triggering a window to show, resulting in losing focus, closing the
omnbox and crashing. But this will verify that's happening.

BUG=92497
TEST=none
R=pkasting@chromium.org

Review URL: http://codereview.chromium.org/7806015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98922 0039d316-1c4b-4281-b951-d872f2087c98
parent 80b2ed6a
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h" #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
#include "base/auto_reset.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
...@@ -138,11 +139,18 @@ class AutocompletePopupContentsView::AutocompletePopupWidget ...@@ -138,11 +139,18 @@ class AutocompletePopupContentsView::AutocompletePopupWidget
: public views::Widget, : public views::Widget,
public base::SupportsWeakPtr<AutocompletePopupWidget> { public base::SupportsWeakPtr<AutocompletePopupWidget> {
public: public:
AutocompletePopupWidget() {} AutocompletePopupWidget() : check_on_destroy_(false) {}
virtual ~AutocompletePopupWidget() {} virtual ~AutocompletePopupWidget() {
CHECK(!check_on_destroy_);
}
private: private:
DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); // TODO(sky): remove once we figure out 92497.
friend class AutocompletePopupContentsView;
bool check_on_destroy_;
DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget);
}; };
class AutocompletePopupContentsView::InstantOptInView class AutocompletePopupContentsView::InstantOptInView
...@@ -238,7 +246,8 @@ AutocompletePopupContentsView::AutocompletePopupContentsView( ...@@ -238,7 +246,8 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
result_font_(font.DeriveFont(kEditFontAdjust)), result_font_(font.DeriveFont(kEditFontAdjust)),
result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)),
ignore_mouse_drag_(false), ignore_mouse_drag_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)),
in_move_above_(false) {
// The following little dance is required because set_border() requires a // The following little dance is required because set_border() requires a
// pointer to a non-const object. // pointer to a non-const object.
views::BubbleBorder* bubble_border = views::BubbleBorder* bubble_border =
...@@ -250,6 +259,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView( ...@@ -250,6 +259,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
} }
AutocompletePopupContentsView::~AutocompletePopupContentsView() { AutocompletePopupContentsView::~AutocompletePopupContentsView() {
CHECK(!in_move_above_);
// We don't need to do anything with |popup_| here. The OS either has already // We don't need to do anything with |popup_| here. The OS either has already
// closed the window, in which case it's been deleted, or it will soon, in // closed the window, in which case it's been deleted, or it will soon, in
// which case there's nothing we need to do. // which case there's nothing we need to do.
...@@ -304,6 +314,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() { ...@@ -304,6 +314,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
// triggered by the popup receiving a message (e.g. LBUTTONUP), and // triggered by the popup receiving a message (e.g. LBUTTONUP), and
// destroying the popup would cause us to read garbage when we unwind back // destroying the popup would cause us to read garbage when we unwind back
// to that level. // to that level.
CHECK(!in_move_above_);
popup_->Close(); // This will eventually delete the popup. popup_->Close(); // This will eventually delete the popup.
popup_.reset(); popup_.reset();
} }
...@@ -362,8 +373,12 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() { ...@@ -362,8 +373,12 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
params.bounds = GetPopupBounds(); params.bounds = GetPopupBounds();
popup_->Init(params); popup_->Init(params);
popup_->SetContentsView(this); popup_->SetContentsView(this);
popup_->MoveAbove( {
GetRelativeWindowForPopup(omnibox_view_->GetNativeView())); AutoReset<bool> in_move_above_reset(&in_move_above_, true);
AutoReset<bool> check_on_destroy_reset(&popup_->check_on_destroy_, true);
popup_->MoveAbove(
GetRelativeWindowForPopup(omnibox_view_->GetNativeView()));
}
popup_->Show(); popup_->Show();
} else { } else {
// Animate the popup shrinking, but don't animate growing larger since that // Animate the popup shrinking, but don't animate growing larger since that
......
...@@ -174,6 +174,11 @@ class AutocompletePopupContentsView : public views::View, ...@@ -174,6 +174,11 @@ class AutocompletePopupContentsView : public views::View,
gfx::Rect start_bounds_; gfx::Rect start_bounds_;
gfx::Rect target_bounds_; gfx::Rect target_bounds_;
// Set to true if we're invoking MoveAbove on the popup. Used in tracking
// 92497.
// TODO(sky): remove when we figure out 92497.
bool in_move_above_;
DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView);
}; };
......
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