This source file includes following definitions.
- AddObserver
- RemoveObserver
- Current
- AddDispatcherForRootWindow
- RemoveDispatcherForRootWindow
- Dispatch
- RunWithDispatcher
#include "base/message_loop/message_pump_ozone.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
namespace base {
MessagePumpOzone::MessagePumpOzone()
: MessagePumpLibevent() {
}
MessagePumpOzone::~MessagePumpOzone() {
}
void MessagePumpOzone::AddObserver(MessagePumpObserver* ) {
NOTIMPLEMENTED();
}
void MessagePumpOzone::RemoveObserver(MessagePumpObserver* ) {
NOTIMPLEMENTED();
}
MessagePumpOzone* MessagePumpOzone::Current() {
MessageLoopForUI* loop = MessageLoopForUI::current();
return static_cast<MessagePumpOzone*>(loop->pump_ui());
}
void MessagePumpOzone::AddDispatcherForRootWindow(
MessagePumpDispatcher* dispatcher) {
DCHECK(dispatcher_.size() == 0);
dispatcher_.insert(dispatcher_.begin(),dispatcher);
}
void MessagePumpOzone::RemoveDispatcherForRootWindow(
MessagePumpDispatcher* dispatcher) {
DCHECK(dispatcher_.size() == 1);
dispatcher_.pop_back();
}
uint32_t MessagePumpOzone::Dispatch(const NativeEvent& dev) {
if (dispatcher_.size() > 0)
return dispatcher_[0]->Dispatch(dev);
return POST_DISPATCH_NONE;
}
void MessagePumpOzone::RunWithDispatcher(
Delegate* delegate, MessagePumpDispatcher* dispatcher) {
dispatcher_.push_back(dispatcher);
Run(delegate);
dispatcher_.pop_back();
}
}