0
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4698 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
dsh@google.com
2008-11-04 22:42:33 +00:00
parent cac407bd57
commit 89062d330c
2 changed files with 9 additions and 5 deletions

@ -54,7 +54,8 @@ static int GetTimeIntervalMilliseconds(Time from) {
MessagePumpForUI::MessagePumpForUI()
: state_(NULL),
context_(g_main_context_default()) {
context_(g_main_context_default()),
work_source_poll_fd_(new GPollFD) {
// Create a pipe with a non-blocking read end for use by ScheduleWork to
// break us out of a poll. Create the work source and attach the file
// descriptor to it.
@ -67,10 +68,10 @@ MessagePumpForUI::MessagePumpForUI()
flags = 0;
CHECK(0 == fcntl(read_fd_work_scheduled_, F_SETFL, flags | O_NONBLOCK)) <<
"Could not set file descriptor to non-blocking!";
GPollFD poll_fd;
poll_fd.fd = read_fd_work_scheduled_;
poll_fd.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
work_source_ = AddSource(&WorkSourceFuncs, G_PRIORITY_DEFAULT, &poll_fd);
work_source_poll_fd_->fd = read_fd_work_scheduled_;
work_source_poll_fd_->events = G_IO_IN | G_IO_HUP | G_IO_ERR;
work_source_ = AddSource(&WorkSourceFuncs, G_PRIORITY_DEFAULT,
work_source_poll_fd_.get());
}
MessagePumpForUI::~MessagePumpForUI() {

@ -8,6 +8,7 @@
#include <glib.h>
#include "base/message_pump.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
namespace base {
@ -91,6 +92,8 @@ class MessagePumpForUI : public MessagePump {
// The work source. It is shared by all calls to Run and destroyed when
// the message pump is destroyed.
GSource* work_source_;
// The GLib poll structure needs to be owned and freed by us.
scoped_ptr<GPollFD> work_source_poll_fd_;
DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
};