summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 19:19:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 19:19:05 +0000
commit7237402696b827997b0a1a340a44bdc994ed1403 (patch)
tree48e488b07cc79ccd3d218647dc4b5a0bcf92280d /chrome/browser
parent5fd3aa4f25bb6c56dcd3069e98cf8f97c709bead (diff)
downloadchromium_src-7237402696b827997b0a1a340a44bdc994ed1403.zip
chromium_src-7237402696b827997b0a1a340a44bdc994ed1403.tar.gz
chromium_src-7237402696b827997b0a1a340a44bdc994ed1403.tar.bz2
Test to see if we can reduce some crashes by deferring delegate destruction until WM_NCDESTROY. This involves adding a specific method to allow delegates to destroy themselves to WindowDelegate, and moving all delete this calls into implementations of that method (to allow delegates to still respond to WM_DESTROY which is legit).
Review URL: http://codereview.chromium.org/40192 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu.cc2
-rw-r--r--chrome/browser/download/download_request_dialog_delegate_win.cc2
-rw-r--r--chrome/browser/download/download_request_dialog_delegate_win.h2
-rw-r--r--chrome/browser/jsmessage_box_handler_win.cc2
-rw-r--r--chrome/browser/jsmessage_box_handler_win.h1
-rw-r--r--chrome/browser/task_manager.cc2
-rw-r--r--chrome/browser/task_manager.h1
-rw-r--r--chrome/browser/views/edit_keyword_controller.cc2
-rw-r--r--chrome/browser/views/edit_keyword_controller.h2
-rw-r--r--chrome/browser/views/external_protocol_dialog.cc2
-rw-r--r--chrome/browser/views/external_protocol_dialog.h2
-rw-r--r--chrome/browser/views/frame/browser_view.cc3
-rw-r--r--chrome/browser/views/frame/browser_view.h1
-rw-r--r--chrome/browser/views/new_profile_dialog.cc2
-rw-r--r--chrome/browser/views/new_profile_dialog.h2
-rw-r--r--chrome/browser/views/options/advanced_page_view.cc2
-rw-r--r--chrome/browser/views/repost_form_warning_view.cc2
-rw-r--r--chrome/browser/views/repost_form_warning_view.h2
-rw-r--r--chrome/browser/views/restart_message_box.cc2
-rw-r--r--chrome/browser/views/restart_message_box.h2
-rw-r--r--chrome/browser/views/shelf_item_dialog.cc3
-rw-r--r--chrome/browser/views/shelf_item_dialog.h1
-rw-r--r--chrome/browser/views/user_data_dir_dialog.cc2
-rw-r--r--chrome/browser/views/user_data_dir_dialog.h2
24 files changed, 22 insertions, 24 deletions
diff --git a/chrome/browser/bookmarks/bookmark_context_menu.cc b/chrome/browser/bookmarks/bookmark_context_menu.cc
index 8c06b4e..7e9f525 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu.cc
@@ -118,7 +118,7 @@ class EditFolderController : public InputWindowDelegate,
virtual void InputCanceled() {
}
- virtual void WindowClosing() {
+ virtual void DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/download/download_request_dialog_delegate_win.cc b/chrome/browser/download/download_request_dialog_delegate_win.cc
index 62d23d5..feae636 100644
--- a/chrome/browser/download/download_request_dialog_delegate_win.cc
+++ b/chrome/browser/download/download_request_dialog_delegate_win.cc
@@ -53,7 +53,7 @@ std::wstring DownloadRequestDialogDelegateWin::GetDialogButtonLabel(
return std::wstring();
}
-void DownloadRequestDialogDelegateWin::WindowClosing() {
+void DownloadRequestDialogDelegateWin::DeleteDelegate() {
DCHECK(!host_);
delete this;
}
diff --git a/chrome/browser/download/download_request_dialog_delegate_win.h b/chrome/browser/download/download_request_dialog_delegate_win.h
index b901483..d720fc0 100644
--- a/chrome/browser/download/download_request_dialog_delegate_win.h
+++ b/chrome/browser/download/download_request_dialog_delegate_win.h
@@ -36,7 +36,7 @@ class DownloadRequestDialogDelegateWin : public DownloadRequestDialogDelegate,
virtual int GetDefaultDialogButton() const {
return DIALOGBUTTON_CANCEL;
}
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
// The TabDownloadState we're displaying the dialog for. May be null.
DownloadRequestManager::TabDownloadState* host_;
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 35eb683..5a6e02c 100644
--- a/chrome/browser/jsmessage_box_handler_win.cc
+++ b/chrome/browser/jsmessage_box_handler_win.cc
@@ -110,7 +110,9 @@ void JavascriptMessageBoxHandler::WindowClosing() {
if (message_box_view_->IsCheckBoxSelected() && web_contents_)
web_contents_->set_suppress_javascript_messages(true);
+}
+void JavascriptMessageBoxHandler::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/jsmessage_box_handler_win.h b/chrome/browser/jsmessage_box_handler_win.h
index e8049d9..4bfc286 100644
--- a/chrome/browser/jsmessage_box_handler_win.h
+++ b/chrome/browser/jsmessage_box_handler_win.h
@@ -36,6 +36,7 @@ class JavascriptMessageBoxHandler
virtual int GetDialogButtons() const;
virtual std::wstring GetWindowTitle() const;
virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool Cancel();
virtual bool Accept();
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index 870b461..ffc20cd 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -1085,7 +1085,9 @@ void TaskManager::WindowClosing() {
// non-client view.
contents_->GetParent()->RemoveChildView(contents_.get());
Close();
+}
+void TaskManager::DeleteDelegate() {
ReleaseWindow();
}
diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h
index beb2136..362a170 100644
--- a/chrome/browser/task_manager.h
+++ b/chrome/browser/task_manager.h
@@ -132,6 +132,7 @@ class TaskManager : public views::DialogDelegate {
virtual std::wstring GetWindowName() const;
virtual int GetDialogButtons() const;
virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual views::View* GetContentsView();
private:
diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc
index 7e01074..1d9f2ed 100644
--- a/chrome/browser/views/edit_keyword_controller.cc
+++ b/chrome/browser/views/edit_keyword_controller.cc
@@ -88,7 +88,7 @@ bool EditKeywordController::IsDialogButtonEnabled(DialogButton button) const {
return true;
}
-void EditKeywordController::WindowClosing() {
+void EditKeywordController::DeleteDelegate() {
// User canceled the save, delete us.
delete this;
}
diff --git a/chrome/browser/views/edit_keyword_controller.h b/chrome/browser/views/edit_keyword_controller.h
index 7268e89..34244b2 100644
--- a/chrome/browser/views/edit_keyword_controller.h
+++ b/chrome/browser/views/edit_keyword_controller.h
@@ -46,7 +46,7 @@ class EditKeywordController : public views::TextField::Controller,
virtual std::wstring GetWindowTitle() const;
virtual int GetDialogButtons() const;
virtual bool IsDialogButtonEnabled(DialogButton button) const;
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool Cancel();
virtual bool Accept();
virtual views::View* GetContentsView();
diff --git a/chrome/browser/views/external_protocol_dialog.cc b/chrome/browser/views/external_protocol_dialog.cc
index c75ccb4..37e137c 100644
--- a/chrome/browser/views/external_protocol_dialog.cc
+++ b/chrome/browser/views/external_protocol_dialog.cc
@@ -63,7 +63,7 @@ std::wstring ExternalProtocolDialog::GetWindowTitle() const {
return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_TITLE);
}
-void ExternalProtocolDialog::WindowClosing() {
+void ExternalProtocolDialog::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/views/external_protocol_dialog.h b/chrome/browser/views/external_protocol_dialog.h
index 720ebae..36e02b7 100644
--- a/chrome/browser/views/external_protocol_dialog.h
+++ b/chrome/browser/views/external_protocol_dialog.h
@@ -39,7 +39,7 @@ class ExternalProtocolDialog : public views::DialogDelegate {
virtual int GetDefaultDialogButton() const;
virtual std::wstring GetDialogButtonLabel(DialogButton button) const;
virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool Accept();
virtual views::View* GetContentsView();
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 207f059..381de05 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1064,9 +1064,6 @@ bool BrowserView::GetSavedMaximizedState(bool* maximized) const {
return true;
}
-void BrowserView::WindowClosing() {
-}
-
views::View* BrowserView::GetContentsView() {
return contents_container_;
}
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index af9a75f..77ff8ae 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -244,7 +244,6 @@ class BrowserView : public BrowserWindow,
bool always_on_top);
virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
virtual bool GetSavedMaximizedState(bool* maximized) const;
- virtual void WindowClosing();
virtual views::View* GetContentsView();
virtual views::ClientView* CreateClientView(views::Window* window);
diff --git a/chrome/browser/views/new_profile_dialog.cc b/chrome/browser/views/new_profile_dialog.cc
index 466d91a..7574789 100644
--- a/chrome/browser/views/new_profile_dialog.cc
+++ b/chrome/browser/views/new_profile_dialog.cc
@@ -75,7 +75,7 @@ std::wstring NewProfileDialog::GetWindowTitle() const {
return l10n_util::GetString(IDS_NEW_PROFILE_DIALOG_TITLE);
}
-void NewProfileDialog::WindowClosing() {
+void NewProfileDialog::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/views/new_profile_dialog.h b/chrome/browser/views/new_profile_dialog.h
index c8e4f02..737cce5 100644
--- a/chrome/browser/views/new_profile_dialog.h
+++ b/chrome/browser/views/new_profile_dialog.h
@@ -34,7 +34,7 @@ class NewProfileDialog : public views::DialogDelegate,
virtual views::View* GetInitiallyFocusedView();
virtual bool IsDialogButtonEnabled(DialogButton button) const;
virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
// views::TextField::Controller methods.
virtual void ContentsChanged(views::TextField* sender,
diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/views/options/advanced_page_view.cc
index 1d4c2ee..b04f975 100644
--- a/chrome/browser/views/options/advanced_page_view.cc
+++ b/chrome/browser/views/options/advanced_page_view.cc
@@ -58,7 +58,7 @@ class ResetDefaultsConfirmBox : public views::DialogDelegate {
return true;
}
// views::WindowDelegate
- virtual void WindowClosing() { delete this; }
+ virtual void DeleteDelegate() { delete this; }
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView() { return message_box_view_; }
diff --git a/chrome/browser/views/repost_form_warning_view.cc b/chrome/browser/views/repost_form_warning_view.cc
index 070e130..b040b8f 100644
--- a/chrome/browser/views/repost_form_warning_view.cc
+++ b/chrome/browser/views/repost_form_warning_view.cc
@@ -64,7 +64,7 @@ std::wstring RepostFormWarningView::GetDialogButtonLabel(
return L"";
}
-void RepostFormWarningView::WindowClosing() {
+void RepostFormWarningView::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/views/repost_form_warning_view.h b/chrome/browser/views/repost_form_warning_view.h
index db8f76b..2e02220 100644
--- a/chrome/browser/views/repost_form_warning_view.h
+++ b/chrome/browser/views/repost_form_warning_view.h
@@ -24,7 +24,7 @@ class RepostFormWarningView : public views::DialogDelegate,
// views::DialogDelegate Methods:
virtual std::wstring GetWindowTitle() const;
virtual std::wstring GetDialogButtonLabel(DialogButton button) const;
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool Cancel();
virtual bool Accept();
diff --git a/chrome/browser/views/restart_message_box.cc b/chrome/browser/views/restart_message_box.cc
index 05fa894..d38d3fb 100644
--- a/chrome/browser/views/restart_message_box.cc
+++ b/chrome/browser/views/restart_message_box.cc
@@ -33,7 +33,7 @@ std::wstring RestartMessageBox::GetWindowTitle() const {
return l10n_util::GetString(IDS_PRODUCT_NAME);
}
-void RestartMessageBox::WindowClosing() {
+void RestartMessageBox::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/views/restart_message_box.h b/chrome/browser/views/restart_message_box.h
index 53f7d28..1e09a03 100644
--- a/chrome/browser/views/restart_message_box.h
+++ b/chrome/browser/views/restart_message_box.h
@@ -24,7 +24,7 @@ class RestartMessageBox : public views::DialogDelegate {
virtual std::wstring GetWindowTitle() const;
// views::WindowDelegate:
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool IsModal() const;
virtual views::View* GetContentsView();
diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc
index e195bae..d7c5518 100644
--- a/chrome/browser/views/shelf_item_dialog.cc
+++ b/chrome/browser/views/shelf_item_dialog.cc
@@ -374,9 +374,6 @@ bool ShelfItemDialog::IsModal() const {
return true;
}
-void ShelfItemDialog::WindowClosing() {
-}
-
std::wstring ShelfItemDialog::GetDialogButtonLabel(DialogButton button) const {
if (button == DialogDelegate::DIALOGBUTTON_OK)
return l10n_util::GetString(IDS_ASI_ADD);
diff --git a/chrome/browser/views/shelf_item_dialog.h b/chrome/browser/views/shelf_item_dialog.h
index fe6e8bb3..f6cb7db 100644
--- a/chrome/browser/views/shelf_item_dialog.h
+++ b/chrome/browser/views/shelf_item_dialog.h
@@ -59,7 +59,6 @@ class ShelfItemDialog : public views::View,
// DialogDelegate.
virtual std::wstring GetWindowTitle() const;
virtual bool IsModal() const;
- virtual void WindowClosing();
virtual std::wstring GetDialogButtonLabel(DialogButton button) const;
virtual bool Accept();
virtual bool IsDialogButtonEnabled(DialogButton button) const;
diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc
index 901c86b..48719a0 100644
--- a/chrome/browser/views/user_data_dir_dialog.cc
+++ b/chrome/browser/views/user_data_dir_dialog.cc
@@ -60,7 +60,7 @@ std::wstring UserDataDirDialog::GetWindowTitle() const {
return l10n_util::GetString(IDS_CANT_WRITE_USER_DIRECTORY_TITLE);
}
-void UserDataDirDialog::WindowClosing() {
+void UserDataDirDialog::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/views/user_data_dir_dialog.h b/chrome/browser/views/user_data_dir_dialog.h
index 42d9aae..cec3406 100644
--- a/chrome/browser/views/user_data_dir_dialog.h
+++ b/chrome/browser/views/user_data_dir_dialog.h
@@ -35,7 +35,7 @@ class UserDataDirDialog : public views::DialogDelegate,
virtual int GetDialogButtons() const;
virtual std::wstring GetDialogButtonLabel(DialogButton button) const;
virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
+ virtual void DeleteDelegate();
virtual bool Accept();
virtual bool Cancel();