| 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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/process/memory.h" | 12 #include "base/process/memory.h" |
| 13 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/win/wrapped_window_proc.h" | 15 #include "base/win/wrapped_window_proc.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 enum MessageLoopProblems { | 21 enum MessageLoopProblems { |
| 21 MESSAGE_POST_ERROR, | 22 MESSAGE_POST_ERROR, |
| 22 COMPLETION_POST_ERROR, | 23 COMPLETION_POST_ERROR, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return; | 313 return; |
| 313 | 314 |
| 314 state_->delegate->DoDelayedWork(&delayed_work_time_); | 315 state_->delegate->DoDelayedWork(&delayed_work_time_); |
| 315 if (!delayed_work_time_.is_null()) { | 316 if (!delayed_work_time_.is_null()) { |
| 316 // A bit gratuitous to set delayed_work_time_ again, but oh well. | 317 // A bit gratuitous to set delayed_work_time_ again, but oh well. |
| 317 ScheduleDelayedWork(delayed_work_time_); | 318 ScheduleDelayedWork(delayed_work_time_); |
| 318 } | 319 } |
| 319 } | 320 } |
| 320 | 321 |
| 321 bool MessagePumpForUI::ProcessNextWindowsMessage() { | 322 bool MessagePumpForUI::ProcessNextWindowsMessage() { |
| 323 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 324 tracked_objects::ScopedTracker tracking_profile( |
| 325 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 326 "440919 <<MessagePumpForUI::ProcessNextWindowsMessage>>")); |
| 327 |
| 322 // If there are sent messages in the queue then PeekMessage internally | 328 // If there are sent messages in the queue then PeekMessage internally |
| 323 // dispatches the message and returns false. We return true in this | 329 // dispatches the message and returns false. We return true in this |
| 324 // case to ensure that the message loop peeks again instead of calling | 330 // case to ensure that the message loop peeks again instead of calling |
| 325 // MsgWaitForMultipleObjectsEx again. | 331 // MsgWaitForMultipleObjectsEx again. |
| 326 bool sent_messages_in_queue = false; | 332 bool sent_messages_in_queue = false; |
| 327 DWORD queue_status = GetQueueStatus(QS_SENDMESSAGE); | 333 DWORD queue_status = GetQueueStatus(QS_SENDMESSAGE); |
| 328 if (HIWORD(queue_status) & QS_SENDMESSAGE) | 334 if (HIWORD(queue_status) & QS_SENDMESSAGE) |
| 329 sent_messages_in_queue = true; | 335 sent_messages_in_queue = true; |
| 330 | 336 |
| 331 MSG msg; | 337 MSG msg; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 633 |
| 628 // static | 634 // static |
| 629 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( | 635 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( |
| 630 ULONG_PTR key, | 636 ULONG_PTR key, |
| 631 bool* has_valid_io_context) { | 637 bool* has_valid_io_context) { |
| 632 *has_valid_io_context = ((key & 1) == 0); | 638 *has_valid_io_context = ((key & 1) == 0); |
| 633 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); | 639 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); |
| 634 } | 640 } |
| 635 | 641 |
| 636 } // namespace base | 642 } // namespace base |
| OLD | NEW |