diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 21:27:02 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 21:27:02 +0000 |
commit | ee132adb94b58e7ea585b1fadf232aa60810ff1b (patch) | |
tree | 71f598a0ed4ea1d7d6e31f3ecf54eefdc4fd2e3b /base/message_loop.cc | |
parent | 1671de4c8e8867be055ff22045afc1d9d946fc84 (diff) | |
download | chromium_src-ee132adb94b58e7ea585b1fadf232aa60810ff1b.zip chromium_src-ee132adb94b58e7ea585b1fadf232aa60810ff1b.tar.gz chromium_src-ee132adb94b58e7ea585b1fadf232aa60810ff1b.tar.bz2 |
just some hopefully non-contentious stuff to get out of the way before doing the real MessageLoop changes.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index 78f820c..37b6f36 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -70,22 +70,6 @@ static const int kNumberOfDistinctMessagesDisplayed = 1100; //------------------------------------------------------------------------------ -static LRESULT CALLBACK MessageLoopWndProc(HWND hwnd, UINT message, - WPARAM wparam, LPARAM lparam) { - switch (message) { - case kMsgQuit: - case kMsgPumpATask: { - UINT_PTR message_loop_id = static_cast<UINT_PTR>(wparam); - MessageLoop* current_message_loop = - reinterpret_cast<MessageLoop*>(message_loop_id); - DCHECK(MessageLoop::current() == current_message_loop); - return current_message_loop->MessageWndProc(hwnd, message, wparam, - lparam); - } - } - return ::DefWindowProc(hwnd, message, wparam, lparam); -} - #ifndef NDEBUG // Force exercise of polling model. #define CHROME_MAXIMUM_WAIT_OBJECTS 8 @@ -385,7 +369,7 @@ void MessageLoop::PostTaskInternal(Task* task) { // Do not invoke non-static methods, or members in any way! // PostMessage may fail, as the hwnd may have vanished due to kMsgQuit. - PostMessage(message_hwnd, kMsgPumpATask, reinterpret_cast<UINT_PTR>(this), 0); + PostMessage(message_hwnd, kMsgPumpATask, 0, 0); } void MessageLoop::InitMessageWnd() { @@ -393,7 +377,7 @@ void MessageLoop::InitMessageWnd() { WNDCLASSEX wc = {0}; wc.cbSize = sizeof(wc); - wc.lpfnWndProc = MessageLoopWndProc; + wc.lpfnWndProc = WndProcThunk; wc.hInstance = hinst; wc.lpszClassName = kWndClass; RegisterClassEx(&wc); @@ -403,8 +387,15 @@ void MessageLoop::InitMessageWnd() { DCHECK(message_hwnd_); } -LRESULT MessageLoop::MessageWndProc(HWND hwnd, UINT message, - WPARAM wparam, LPARAM lparam) { +// static +LRESULT CALLBACK MessageLoop::WndProcThunk( + HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { + DCHECK(MessageLoop::current()); + return MessageLoop::current()->WndProc(hwnd, message, wparam, lparam); +} + +LRESULT MessageLoop::WndProc( + HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { DCHECK(hwnd == message_hwnd_); switch (message) { case kMsgPumpATask: { @@ -773,8 +764,7 @@ void MessageLoop::EnsureMessageGetsPosted(int message) const { for (int i = 0; i < kRetryCount; ++i) { // Posting to our own windows should always succeed. If it doesn't we're in // big trouble. - if (PostMessage(message_hwnd_, message, - reinterpret_cast<UINT_PTR>(this), 0)) + if (PostMessage(message_hwnd_, message, 0, 0)) return; Sleep(kSleepDurationWhenFailing); } |