summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 22:38:09 +0000
committererikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 22:38:09 +0000
commitc735dd0568ce04e9d6ee9a9426c51a00aecfa832 (patch)
tree3b8b1e31553298b8b38d8b537a5ae5512f571759
parent30244d4e07a6016ff6810e40567284a9978758d2 (diff)
downloadchromium_src-c735dd0568ce04e9d6ee9a9426c51a00aecfa832.zip
chromium_src-c735dd0568ce04e9d6ee9a9426c51a00aecfa832.tar.gz
chromium_src-c735dd0568ce04e9d6ee9a9426c51a00aecfa832.tar.bz2
Merge 246604 "mac: Fix a bug where the history swipe arrow would..."
> mac: Fix a bug where the history swipe arrow would fail to disappear. > > Previously, the arrow was being added to the window. I changed the logic to add > the arrow to the render_widget_host_view. I was unable to trace down the source > of the bug, but I suspect that there are race conditions that induce a memory > leak of the chrome_render_widget_host_view_mac_delegate, as that's the only way > for the arrow to fail to disappear. > > I have been unable to reproduce the bug locally, but mehmet@ was able to > reproduce it on his machine, and this change fixes the problem. > > BUG=330312 > NOTRY=true > > Review URL: https://codereview.chromium.org/139743013 TBR=erikchen@chromium.org Review URL: https://codereview.chromium.org/154383004 git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@248793 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/history_overlay_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/history_overlay_controller_unittest.mm12
2 files changed, 7 insertions, 9 deletions
diff --git a/chrome/browser/ui/cocoa/history_overlay_controller.mm b/chrome/browser/ui/cocoa/history_overlay_controller.mm
index 16f3ab5..cdfb196 100644
--- a/chrome/browser/ui/cocoa/history_overlay_controller.mm
+++ b/chrome/browser/ui/cocoa/history_overlay_controller.mm
@@ -135,9 +135,7 @@ const CGFloat kShieldHeightCompletionAdjust = 10;
- (void)showPanelForView:(NSView*)view {
parent_.reset([view retain]);
[self setProgress:0 finished:NO]; // Set initial view position.
- [[parent_ superview] addSubview:self.view
- positioned:NSWindowAbove
- relativeTo:parent_];
+ [parent_ addSubview:self.view];
[[BrowserWindowController
browserWindowControllerForView:[self view]] onOverlappedViewShown];
}
diff --git a/chrome/browser/ui/cocoa/history_overlay_controller_unittest.mm b/chrome/browser/ui/cocoa/history_overlay_controller_unittest.mm
index d550f81..66cb5a9 100644
--- a/chrome/browser/ui/cocoa/history_overlay_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/history_overlay_controller_unittest.mm
@@ -17,9 +17,10 @@ class HistoryOverlayControllerTest : public CocoaTest {
virtual void SetUp() {
CocoaTest::SetUp();
- // The overlay controller shows the panel in the superview of a given
- // view, so create the given view.
+ // The overlay controller shows the panel as a subview of the given view.
test_view_.reset([[NSView alloc] initWithFrame:NSMakeRect(10, 10, 10, 10)]);
+
+ // We add it to the test_window for authenticity.
[[test_window() contentView] addSubview:test_view_];
}
@@ -35,13 +36,12 @@ class HistoryOverlayControllerTest : public CocoaTest {
// is removed when the animation completes. The view should be added and
// removed at the appropriate times.
TEST_F(HistoryOverlayControllerTest, DismissClearsAnimationsAndRemovesView) {
- NSView* content_view = [test_window() contentView];
- EXPECT_EQ(1u, [[content_view subviews] count]);
+ EXPECT_EQ(0u, [[test_view() subviews] count]);
base::scoped_nsobject<HistoryOverlayController> controller(
[[HistoryOverlayController alloc] initForMode:kHistoryOverlayModeBack]);
[controller showPanelForView:test_view()];
- EXPECT_EQ(2u, [[content_view subviews] count]);
+ EXPECT_EQ(1u, [[test_view() subviews] count]);
scoped_ptr<base::MessagePumpNSRunLoop> message_pump(
new base::MessagePumpNSRunLoop);
@@ -78,5 +78,5 @@ TEST_F(HistoryOverlayControllerTest, DismissClearsAnimationsAndRemovesView) {
// After the animation runs, there should be no more animations.
EXPECT_FALSE([[controller view] animations]);
- EXPECT_EQ(1u, [[content_view subviews] count]);
+ EXPECT_EQ(0u, [[test_view() subviews] count]);
}