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 <limits> | 7 #include <limits> |
8 #include <math.h> | 8 #include <math.h> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // (we think), so this will probably be recoverable. | 470 // (we think), so this will probably be recoverable. |
471 UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem", | 471 UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem", |
472 MESSAGE_POST_ERROR, | 472 MESSAGE_POST_ERROR, |
473 MESSAGE_LOOP_PROBLEM_MAX); | 473 MESSAGE_LOOP_PROBLEM_MAX); |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 void MessagePumpForUI::SetWakeupTimer(int64 delay_ms) { | 477 void MessagePumpForUI::SetWakeupTimer(int64 delay_ms) { |
478 // Set the timer for the delay passed in. The actual resolution of the | 478 // Set the timer for the delay passed in. The actual resolution of the |
479 // timer is dependent on whether timeBeginPeriod was called. | 479 // timer is dependent on whether timeBeginPeriod was called. |
480 LARGE_INTEGER due_time = {0}; | 480 LARGE_INTEGER due_time = {}; |
481 due_time.QuadPart = -delay_ms * 10000; | 481 due_time.QuadPart = -delay_ms * 10000; |
482 BOOL timer_set = ::SetWaitableTimer(ui_worker_thread_timer_.Get(), | 482 BOOL timer_set = ::SetWaitableTimer(ui_worker_thread_timer_.Get(), |
483 &due_time, 0, NULL, NULL, FALSE); | 483 &due_time, 0, NULL, NULL, FALSE); |
484 CHECK(timer_set); | 484 CHECK(timer_set); |
485 } | 485 } |
486 | 486 |
487 void MessagePumpForUI::ScheduleWorkHelper() { | 487 void MessagePumpForUI::ScheduleWorkHelper() { |
488 // Set the flag which allows the UI worker thread to repost the timer to | 488 // Set the flag which allows the UI worker thread to repost the timer to |
489 // process tasks which may not have been ready to run in the first iteration. | 489 // process tasks which may not have been ready to run in the first iteration. |
490 ::InterlockedExchange(&force_fallback_timer_for_tasks_, 1); | 490 ::InterlockedExchange(&force_fallback_timer_for_tasks_, 1); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 // static | 719 // static |
720 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( | 720 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( |
721 ULONG_PTR key, | 721 ULONG_PTR key, |
722 bool* has_valid_io_context) { | 722 bool* has_valid_io_context) { |
723 *has_valid_io_context = ((key & 1) == 0); | 723 *has_valid_io_context = ((key & 1) == 0); |
724 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); | 724 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); |
725 } | 725 } |
726 | 726 |
727 } // namespace base | 727 } // namespace base |
OLD | NEW |