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 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return timeout < 0 ? 0 : | 83 return timeout < 0 ? 0 : |
84 (timeout > std::numeric_limits<int>::max() ? | 84 (timeout > std::numeric_limits<int>::max() ? |
85 std::numeric_limits<int>::max() : static_cast<int>(timeout)); | 85 std::numeric_limits<int>::max() : static_cast<int>(timeout)); |
86 } | 86 } |
87 | 87 |
88 //----------------------------------------------------------------------------- | 88 //----------------------------------------------------------------------------- |
89 // MessagePumpForUI public: | 89 // MessagePumpForUI public: |
90 | 90 |
91 MessagePumpForUI::MessagePumpForUI() { | 91 MessagePumpForUI::MessagePumpForUI() { |
92 bool succeeded = message_window_.Create( | 92 bool succeeded = message_window_.Create( |
93 Bind(&MessagePumpForUI::MessageCallback, Unretained(this))); | 93 BindRepeating(&MessagePumpForUI::MessageCallback, Unretained(this))); |
94 DCHECK(succeeded); | 94 DCHECK(succeeded); |
95 } | 95 } |
96 | 96 |
97 MessagePumpForUI::~MessagePumpForUI() = default; | 97 MessagePumpForUI::~MessagePumpForUI() = default; |
98 | 98 |
99 void MessagePumpForUI::ScheduleWork() { | 99 void MessagePumpForUI::ScheduleWork() { |
100 if (InterlockedExchange(&work_state_, HAVE_WORK) != READY) | 100 if (InterlockedExchange(&work_state_, HAVE_WORK) != READY) |
101 return; // Someone else continued the pumping. | 101 return; // Someone else continued the pumping. |
102 | 102 |
103 // Make sure the MessagePump does some work for us. | 103 // Make sure the MessagePump does some work for us. |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 if (!filter || it->handler == filter) { | 571 if (!filter || it->handler == filter) { |
572 *item = *it; | 572 *item = *it; |
573 completed_io_.erase(it); | 573 completed_io_.erase(it); |
574 return true; | 574 return true; |
575 } | 575 } |
576 } | 576 } |
577 return false; | 577 return false; |
578 } | 578 } |
579 | 579 |
580 } // namespace base | 580 } // namespace base |
OLD | NEW |