| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/message_loop/message_pump_win.h" | 5 #include "base/message_loop/message_pump_win.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 MESSAGE_LOOP_PROBLEM_MAX); | 156 MESSAGE_LOOP_PROBLEM_MAX); |
| 157 } | 157 } |
| 158 | 158 |
| 159 //----------------------------------------------------------------------------- | 159 //----------------------------------------------------------------------------- |
| 160 // MessagePumpForUI private: | 160 // MessagePumpForUI private: |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 LRESULT CALLBACK MessagePumpForUI::WndProcThunk( | 163 LRESULT CALLBACK MessagePumpForUI::WndProcThunk( |
| 164 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { | 164 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { |
| 165 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. | 165 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 166 tracked_objects::ScopedTracker tracking_profile( | 166 tracked_objects::ScopedTracker tracking_profile1( |
| 167 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 167 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 168 "440919 MessagePumpForUI::WndProcThunk")); | 168 "440919 MessagePumpForUI::WndProcThunk1")); |
| 169 | 169 |
| 170 switch (message) { | 170 switch (message) { |
| 171 case kMsgHaveWork: | 171 case kMsgHaveWork: |
| 172 reinterpret_cast<MessagePumpForUI*>(wparam)->HandleWorkMessage(); | 172 reinterpret_cast<MessagePumpForUI*>(wparam)->HandleWorkMessage(); |
| 173 break; | 173 break; |
| 174 case WM_TIMER: | 174 case WM_TIMER: |
| 175 reinterpret_cast<MessagePumpForUI*>(wparam)->HandleTimerMessage(); | 175 reinterpret_cast<MessagePumpForUI*>(wparam)->HandleTimerMessage(); |
| 176 break; | 176 break; |
| 177 } | 177 } |
| 178 |
| 179 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 180 tracked_objects::ScopedTracker tracking_profile2( |
| 181 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 182 "440919 MessagePumpForUI::WndProcThunk2")); |
| 183 |
| 178 return DefWindowProc(hwnd, message, wparam, lparam); | 184 return DefWindowProc(hwnd, message, wparam, lparam); |
| 179 } | 185 } |
| 180 | 186 |
| 181 void MessagePumpForUI::DoRunLoop() { | 187 void MessagePumpForUI::DoRunLoop() { |
| 182 // IF this was just a simple PeekMessage() loop (servicing all possible work | 188 // IF this was just a simple PeekMessage() loop (servicing all possible work |
| 183 // queues), then Windows would try to achieve the following order according | 189 // queues), then Windows would try to achieve the following order according |
| 184 // to MSDN documentation about PeekMessage with no filter): | 190 // to MSDN documentation about PeekMessage with no filter): |
| 185 // * Sent messages | 191 // * Sent messages |
| 186 // * Posted messages | 192 // * Posted messages |
| 187 // * Sent messages (again) | 193 // * Sent messages (again) |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 681 |
| 676 // static | 682 // static |
| 677 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( | 683 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( |
| 678 ULONG_PTR key, | 684 ULONG_PTR key, |
| 679 bool* has_valid_io_context) { | 685 bool* has_valid_io_context) { |
| 680 *has_valid_io_context = ((key & 1) == 0); | 686 *has_valid_io_context = ((key & 1) == 0); |
| 681 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); | 687 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); |
| 682 } | 688 } |
| 683 | 689 |
| 684 } // namespace base | 690 } // namespace base |
| OLD | NEW |