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

Side by Side Diff: webkit/tools/test_shell/test_shell_gtk.cc

Issue 13214: Handle destruction of test shell properly. (Closed)
Patch Set: Created 12 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 | « webkit/tools/test_shell/test_shell.cc ('k') | webkit/tools/test_shell/webwidget_host_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/test_shell.h" 5 #include "webkit/tools/test_shell/test_shell.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <fontconfig/fontconfig.h> 9 #include <fontconfig/fontconfig.h>
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 TestShell *shell = new TestShell(); 128 TestShell *shell = new TestShell();
129 if (!shell->Initialize(startingURL)) 129 if (!shell->Initialize(startingURL))
130 return false; 130 return false;
131 if (result) 131 if (result)
132 *result = shell; 132 *result = shell;
133 TestShell::windowList()->push_back(shell->m_mainWnd); 133 TestShell::windowList()->push_back(shell->m_mainWnd);
134 return true; 134 return true;
135 } 135 }
136 136
137 void TestShell::PlatformCleanUp() { 137 void TestShell::PlatformCleanUp() {
138 // The GTK widgets will be destroyed, which will free the associated
139 // objects. So we don't need the scoped_ptr to free the webViewHost.
140 m_webViewHost.release();
138 } 141 }
139 142
140 // GTK callbacks ------------------------------------------------------ 143 // GTK callbacks ------------------------------------------------------
141 namespace { 144 namespace {
142 145
143 // Callback for when the main window is destroyed. 146 // Callback for when the main window is destroyed.
144 void MainWindowDestroyed(GtkWindow* window, TestShell* shell) { 147 gboolean MainWindowDestroyed(GtkWindow* window, TestShell* shell) {
148
145 TestShell::RemoveWindowFromList(GTK_WIDGET(window)); 149 TestShell::RemoveWindowFromList(GTK_WIDGET(window));
146 150
147 if (TestShell::windowList()->empty() || shell->is_modal()) { 151 if (TestShell::windowList()->empty() || shell->is_modal()) {
148 MessageLoop::current()->PostTask(FROM_HERE, 152 MessageLoop::current()->PostTask(FROM_HERE,
149 new MessageLoop::QuitTask()); 153 new MessageLoop::QuitTask());
150 } 154 }
151 155
152 delete shell; 156 delete shell;
157
158 return FALSE; // Don't stop this message.
153 } 159 }
154 160
155 // Callback for when you click the back button. 161 // Callback for when you click the back button.
156 void BackButtonClicked(GtkButton* button, TestShell* shell) { 162 void BackButtonClicked(GtkButton* button, TestShell* shell) {
157 shell->GoBackOrForward(-1); 163 shell->GoBackOrForward(-1);
158 } 164 }
159 165
160 // Callback for when you click the forward button. 166 // Callback for when you click the forward button.
161 void ForwardButtonClicked(GtkButton* button, TestShell* shell) { 167 void ForwardButtonClicked(GtkButton* button, TestShell* shell) {
162 shell->GoBackOrForward(1); 168 shell->GoBackOrForward(1);
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 // of NOTIMPLEMENTED into our layout test diffs. 717 // of NOTIMPLEMENTED into our layout test diffs.
712 // NOTIMPLEMENTED(); 718 // NOTIMPLEMENTED();
713 return false; 719 return false;
714 } 720 }
715 721
716 ScreenInfo GetScreenInfo(gfx::ViewHandle window) { 722 ScreenInfo GetScreenInfo(gfx::ViewHandle window) {
717 return GetScreenInfoHelper(window); 723 return GetScreenInfoHelper(window);
718 } 724 }
719 725
720 } // namespace webkit_glue 726 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_shell.cc ('k') | webkit/tools/test_shell/webwidget_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698