OLD | NEW |
1 // Copyright (c) 2011 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_pump_win.h" | 5 #include "base/message_pump_win.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/win/wrapped_window_proc.h" | 11 #include "base/win/wrapped_window_proc.h" |
(...skipping 19 matching lines...) Expand all Loading... |
31 | 31 |
32 void MessagePumpWin::WillProcessMessage(const MSG& msg) { | 32 void MessagePumpWin::WillProcessMessage(const MSG& msg) { |
33 FOR_EACH_OBSERVER(MessagePumpObserver, observers_, WillProcessEvent(msg)); | 33 FOR_EACH_OBSERVER(MessagePumpObserver, observers_, WillProcessEvent(msg)); |
34 } | 34 } |
35 | 35 |
36 void MessagePumpWin::DidProcessMessage(const MSG& msg) { | 36 void MessagePumpWin::DidProcessMessage(const MSG& msg) { |
37 FOR_EACH_OBSERVER(MessagePumpObserver, observers_, DidProcessEvent(msg)); | 37 FOR_EACH_OBSERVER(MessagePumpObserver, observers_, DidProcessEvent(msg)); |
38 } | 38 } |
39 | 39 |
40 void MessagePumpWin::RunWithDispatcher( | 40 void MessagePumpWin::RunWithDispatcher( |
41 Delegate* delegate, Dispatcher* dispatcher) { | 41 Delegate* delegate, MessagePumpDispatcher* dispatcher) { |
42 RunState s; | 42 RunState s; |
43 s.delegate = delegate; | 43 s.delegate = delegate; |
44 s.dispatcher = dispatcher; | 44 s.dispatcher = dispatcher; |
45 s.should_quit = false; | 45 s.should_quit = false; |
46 s.run_depth = state_ ? state_->run_depth + 1 : 1; | 46 s.run_depth = state_ ? state_->run_depth + 1 : 1; |
47 | 47 |
48 RunState* previous_state = state_; | 48 RunState* previous_state = state_; |
49 state_ = &s; | 49 state_ = &s; |
50 | 50 |
51 DoRunLoop(); | 51 DoRunLoop(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // While running our main message pump, we discard kMsgHaveWork messages. | 344 // While running our main message pump, we discard kMsgHaveWork messages. |
345 if (msg.message == kMsgHaveWork && msg.hwnd == message_hwnd_) | 345 if (msg.message == kMsgHaveWork && msg.hwnd == message_hwnd_) |
346 return ProcessPumpReplacementMessage(); | 346 return ProcessPumpReplacementMessage(); |
347 | 347 |
348 if (CallMsgFilter(const_cast<MSG*>(&msg), kMessageFilterCode)) | 348 if (CallMsgFilter(const_cast<MSG*>(&msg), kMessageFilterCode)) |
349 return true; | 349 return true; |
350 | 350 |
351 WillProcessMessage(msg); | 351 WillProcessMessage(msg); |
352 | 352 |
353 if (state_->dispatcher) { | 353 if (state_->dispatcher) { |
354 if (!state_->dispatcher->Dispatch(msg)) | 354 if (state_->dispatcher->Dispatch(msg) == base::EVENT_QUIT) |
355 state_->should_quit = true; | 355 state_->should_quit = true; |
356 } else { | 356 } else { |
357 TranslateMessage(&msg); | 357 TranslateMessage(&msg); |
358 DispatchMessage(&msg); | 358 DispatchMessage(&msg); |
359 } | 359 } |
360 | 360 |
361 DidProcessMessage(msg); | 361 DidProcessMessage(msg); |
362 return true; | 362 return true; |
363 } | 363 } |
364 | 364 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 void MessagePumpForIO::WillProcessIOEvent() { | 575 void MessagePumpForIO::WillProcessIOEvent() { |
576 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); | 576 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); |
577 } | 577 } |
578 | 578 |
579 void MessagePumpForIO::DidProcessIOEvent() { | 579 void MessagePumpForIO::DidProcessIOEvent() { |
580 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); | 580 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); |
581 } | 581 } |
582 | 582 |
583 } // namespace base | 583 } // namespace base |
OLD | NEW |