summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 04:14:21 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 04:14:21 +0000
commitde016ebcdfde1345a9463af1e50b7645f6909ffc (patch)
treea67d7517d4f65550465a5bc9a0e1c358ae2ab1c6
parent4646f29cf92e2b3cd70158067d11431ae9351bcf (diff)
downloadchromium_src-de016ebcdfde1345a9463af1e50b7645f6909ffc.zip
chromium_src-de016ebcdfde1345a9463af1e50b7645f6909ffc.tar.gz
chromium_src-de016ebcdfde1345a9463af1e50b7645f6909ffc.tar.bz2
Remove TRACK_HWND_CREATION/TRACK_HWND_DESTRUCTION macro since the bug it was created for has long been closed. This code causes crashes when the browser is closed with the task manager open (in debug builds at the very least).
Review URL: http://codereview.chromium.org/115553 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16462 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/win_util.cc63
-rw-r--r--base/win_util.h13
-rw-r--r--chrome/browser/plugin_process_host.cc1
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc4
-rw-r--r--views/controls/native_control.cc5
-rw-r--r--views/controls/native_control_win.cc3
-rw-r--r--views/controls/text_field.cc14
-rw-r--r--views/widget/widget_win.cc2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc5
-rw-r--r--webkit/tools/test_shell/webwidget_host_win.cc4
10 files changed, 0 insertions, 114 deletions
diff --git a/base/win_util.cc b/base/win_util.cc
index 2f1ceb9..c379703 100644
--- a/base/win_util.cc
+++ b/base/win_util.cc
@@ -4,16 +4,13 @@
#include "base/win_util.h"
-#include <map>
#include <sddl.h>
#include "base/logging.h"
#include "base/registry.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
-#include "base/singleton.h"
#include "base/string_util.h"
-#include "base/tracked.h"
namespace win_util {
@@ -376,66 +373,6 @@ std::wstring FormatLastWin32Error() {
return FormatMessage(GetLastError());
}
-typedef std::map<HWND, tracked_objects::Location> HWNDInfoMap;
-struct HWNDBirthMapTrait : public DefaultSingletonTraits<HWNDInfoMap> {
-};
-struct HWNDDeathMapTrait : public DefaultSingletonTraits<HWNDInfoMap> {
-};
-
-void NotifyHWNDCreation(const tracked_objects::Location& from_here, HWND hwnd) {
- HWNDInfoMap* birth_map = Singleton<HWNDInfoMap, HWNDBirthMapTrait>::get();
- HWNDInfoMap::iterator birth_iter = birth_map->find(hwnd);
- if (birth_iter != birth_map->end()) {
- birth_map->erase(birth_iter);
-
- // We have already seen this HWND, was it destroyed?
- HWNDInfoMap* death_map = Singleton<HWNDInfoMap, HWNDDeathMapTrait>::get();
- HWNDInfoMap::iterator death_iter = death_map->find(hwnd);
- if (death_iter == death_map->end()) {
- // We did not get a destruction notification. The code is probably not
- // calling NotifyHWNDDestruction for that HWND.
- NOTREACHED() << "Creation of HWND reported for already tracked HWND. The "
- "HWND destruction is probably not tracked properly. "
- "Fix it!";
- } else {
- death_map->erase(death_iter);
- }
- }
- birth_map->insert(std::pair<HWND, tracked_objects::Location>(hwnd,
- from_here));
-}
-
-void NotifyHWNDDestruction(const tracked_objects::Location& from_here,
- HWND hwnd) {
- HWNDInfoMap* death_map = Singleton<HWNDInfoMap, HWNDDeathMapTrait>::get();
- HWNDInfoMap::iterator death_iter = death_map->find(hwnd);
-
- HWNDInfoMap* birth_map = Singleton<HWNDInfoMap, HWNDBirthMapTrait>::get();
- HWNDInfoMap::iterator birth_iter = birth_map->find(hwnd);
-
- if (death_iter != death_map->end()) {
- std::string allocation, first_delete, second_delete;
- if (birth_iter != birth_map->end())
- birth_iter->second.Write(true, true, &allocation);
- death_iter->second.Write(true, true, &first_delete);
- from_here.Write(true, true, &second_delete);
- LOG(FATAL) << "Double delete of an HWND. Please file a bug with info on "
- "how you got that assertion and the following information:\n"
- "Double delete of HWND 0x" << hwnd << "\n" <<
- "Allocated at " << allocation << "\n" <<
- "Deleted first at " << first_delete << "\n" <<
- "Deleted again at " << second_delete;
- death_map->erase(death_iter);
- }
-
- if (birth_iter == birth_map->end()) {
- NOTREACHED() << "Destruction of HWND reported for unknown HWND. The HWND "
- "construction is probably not tracked properly. Fix it!";
- }
- death_map->insert(std::pair<HWND, tracked_objects::Location>(hwnd,
- from_here));
-}
-
} // namespace win_util
#ifdef _MSC_VER
diff --git a/base/win_util.h b/base/win_util.h
index 284b9bd..e628bd7 100644
--- a/base/win_util.h
+++ b/base/win_util.h
@@ -10,8 +10,6 @@
#include <string>
-#include "base/tracked.h"
-
namespace win_util {
// NOTE: Keep these in order so callers can do things like
@@ -106,17 +104,6 @@ std::wstring FormatMessage(unsigned messageid);
// Uses the last Win32 error to generate a human readable message string.
std::wstring FormatLastWin32Error();
-// These 2 methods are used to track HWND creation/destruction to investigate
-// a mysterious crasher http://crbugs.com/4714 (crasher in on NCDestroy) that
-// might be caused by a multiple delete of an HWND.
-void NotifyHWNDCreation(const tracked_objects::Location& from_here, HWND hwnd);
-void NotifyHWNDDestruction(const tracked_objects::Location& from_here,
- HWND hwnd);
-
-#define TRACK_HWND_CREATION(hwnd) win_util::NotifyHWNDCreation(FROM_HERE, hwnd)
-#define TRACK_HWND_DESTRUCTION(hwnd) \
- win_util::NotifyHWNDDestruction(FROM_HERE, hwnd)
-
} // namespace win_util
#endif // BASE_WIN_UTIL_H__
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index fc2f383..cd5af7b 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -45,7 +45,6 @@
#if defined(OS_WIN)
#include "app/win_util.h"
-#include "base/win_util.h"
#include "chrome/browser/sandbox_policy.h"
#include "sandbox/src/sandbox.h"
#endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 22f50f7..f8e50c7 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -661,7 +661,6 @@ LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) {
// Call the WM_INPUTLANGCHANGE message handler to initialize the input locale
// of a browser process.
OnInputLangChange(0, 0);
- TRACK_HWND_CREATION(m_hWnd);
// Marks that window as supporting mouse-wheel messages rerouting so it is
// scrolled when under the mouse pointer even if inactive.
views::SetWindowSupportsRerouteMouseWheel(m_hWnd);
@@ -682,9 +681,6 @@ void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized,
void RenderWidgetHostViewWin::OnDestroy() {
ResetTooltip();
TrackMouseLeave(false);
-#ifdef ENABLE_TRACK_HWND_DESTRUCTION
- TRACK_HWND_DESTRUCTION(m_hWnd);
-#endif // ENABLE_TRACK_HWND_DESTRUCTION
}
void RenderWidgetHostViewWin::OnPaint(HDC dc) {
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc
index fefed51..d5293b2 100644
--- a/views/controls/native_control.cc
+++ b/views/controls/native_control.cc
@@ -79,10 +79,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
private:
LRESULT OnCreate(LPCREATESTRUCT create_struct) {
- TRACK_HWND_CREATION(m_hWnd);
-
control_ = parent_->CreateNativeControl(m_hWnd);
- TRACK_HWND_CREATION(control_);
FocusManager::InstallFocusSubclass(control_, parent_);
@@ -125,7 +122,6 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
void OnDestroy() {
if (parent_)
parent_->OnDestroy();
- TRACK_HWND_DESTRUCTION(m_hWnd);
}
void OnContextMenu(HWND window, const WTL::CPoint& location) {
@@ -376,7 +372,6 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message,
reinterpret_cast<WNDPROC>(original_handler));
RemoveProp(window, kHandlerKey);
RemoveProp(window, kNativeControlKey);
- TRACK_HWND_DESTRUCTION(window);
}
return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window,
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc
index 0c1baf8..c1ddadf 100644
--- a/views/controls/native_control_win.cc
+++ b/views/controls/native_control_win.cc
@@ -112,8 +112,6 @@ void NativeControlWin::ShowContextMenu(const gfx::Point& location) {
}
void NativeControlWin::NativeControlCreated(HWND native_control) {
- TRACK_HWND_CREATION(native_control);
-
// Associate this object with the control's HWND so that WidgetWin can find
// this object when it receives messages from it.
SetProp(native_control, kNativeControlWinKey, this);
@@ -191,7 +189,6 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window,
} else if (message == WM_DESTROY) {
win_util::SetWindowProc(window, native_control->original_wndproc_);
RemoveProp(window, kNativeControlWinKey);
- TRACK_HWND_DESTRUCTION(window);
}
return CallWindowProc(native_control->original_wndproc_, window, message,
diff --git a/views/controls/text_field.cc b/views/controls/text_field.cc
index 76732a1..2a608bb 100644
--- a/views/controls/text_field.cc
+++ b/views/controls/text_field.cc
@@ -71,9 +71,7 @@ class TextField::Edit
MSG_WM_CHAR(OnChar)
MSG_WM_CONTEXTMENU(OnContextMenu)
MSG_WM_COPY(OnCopy)
- MSG_WM_CREATE(OnCreate)
MSG_WM_CUT(OnCut)
- MSG_WM_DESTROY(OnDestroy)
MESSAGE_HANDLER_EX(WM_IME_CHAR, OnImeChar)
MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeStartComposition)
MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeComposition)
@@ -121,9 +119,7 @@ class TextField::Edit
void OnChar(TCHAR key, UINT repeat_count, UINT flags);
void OnContextMenu(HWND window, const CPoint& point);
void OnCopy();
- LRESULT OnCreate(CREATESTRUCT* create_struct);
void OnCut();
- void OnDestroy();
LRESULT OnImeChar(UINT message, WPARAM wparam, LPARAM lparam);
LRESULT OnImeStartComposition(UINT message, WPARAM wparam, LPARAM lparam);
LRESULT OnImeComposition(UINT message, WPARAM wparam, LPARAM lparam);
@@ -427,12 +423,6 @@ void TextField::Edit::OnCopy() {
}
}
-LRESULT TextField::Edit::OnCreate(CREATESTRUCT* create_struct) {
- SetMsgHandled(FALSE);
- TRACK_HWND_CREATION(m_hWnd);
- return 0;
-}
-
void TextField::Edit::OnCut() {
if (parent_->IsReadOnly() || parent_->IsPassword())
return;
@@ -444,10 +434,6 @@ void TextField::Edit::OnCut() {
ReplaceSel(L"", true);
}
-void TextField::Edit::OnDestroy() {
- TRACK_HWND_DESTRUCTION(m_hWnd);
-}
-
LRESULT TextField::Edit::OnImeChar(UINT message, WPARAM wparam, LPARAM lparam) {
// http://crbug.com/7707: a rich-edit control may crash when it receives a
// WM_IME_CHAR message while it is processing a WM_IME_COMPOSITION message.
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 4dfb0ca..fdb6252 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -179,7 +179,6 @@ void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
window_style_, bounds.x(), bounds.y(), bounds.width(),
bounds.height(), parent, NULL, NULL, this);
DCHECK(hwnd_);
- TRACK_HWND_CREATION(hwnd_);
SetWindowSupportsRerouteMouseWheel(hwnd_);
// The window procedure should have set the data for us.
@@ -1031,7 +1030,6 @@ LRESULT CALLBACK WidgetWin::WndProc(HWND window, UINT message,
if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result))
result = DefWindowProc(window, message, w_param, l_param);
if (message == WM_NCDESTROY) {
- TRACK_HWND_DESTRUCTION(window);
widget->hwnd_ = NULL;
widget->OnFinalMessage(window);
}
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index 2addf7f..2c41851 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -13,7 +13,6 @@
#include "base/message_loop.h"
#include "base/stats_counters.h"
#include "base/string_util.h"
-#include "base/win_util.h"
#include "webkit/default_plugin/plugin_impl.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webplugin.h"
@@ -205,7 +204,6 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
WebPluginDelegateImpl::~WebPluginDelegateImpl() {
if (::IsWindow(dummy_window_for_activation_)) {
::DestroyWindow(dummy_window_for_activation_);
- TRACK_HWND_DESTRUCTION(dummy_window_for_activation_);
}
DestroyInstance();
@@ -460,7 +458,6 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() {
0,
GetModuleHandle(NULL),
0);
- TRACK_HWND_CREATION(windowed_handle_);
if (windowed_handle_ == 0)
return false;
@@ -522,7 +519,6 @@ void WebPluginDelegateImpl::WindowedDestroyWindow() {
plugin_->WillDestroyWindow(windowed_handle_);
DestroyWindow(windowed_handle_);
- TRACK_HWND_DESTRUCTION(windowed_handle_);
windowed_handle_ = 0;
}
}
@@ -675,7 +671,6 @@ bool WebPluginDelegateImpl::CreateDummyWindowForActivation() {
0,
GetModuleHandle(NULL),
0);
- TRACK_HWND_CREATION(dummy_window_for_activation_);
if (dummy_window_for_activation_ == 0)
return false;
diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc
index 9deca4c..44fd523 100644
--- a/webkit/tools/test_shell/webwidget_host_win.cc
+++ b/webkit/tools/test_shell/webwidget_host_win.cc
@@ -50,7 +50,6 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_view,
kWindowClassName, kWindowClassName, WS_POPUP,
0, 0, 0, 0,
parent_view, NULL, GetModuleHandle(NULL), NULL);
- TRACK_HWND_CREATION(host->view_);
win_util::SetWindowUserData(host->view_, host);
host->webwidget_ = WebWidget::Create(delegate);
@@ -71,9 +70,6 @@ LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam,
case WM_DESTROY:
delete host;
break;
- case WM_NCDESTROY:
- TRACK_HWND_DESTRUCTION(hwnd);
- break;
case WM_PAINT: {
RECT rect;