summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 22:42:33 +0000
committerdsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 22:42:33 +0000
commit89062d330ccdcf875842ae679d59a9fcd8d14b65 (patch)
tree34ba778efaf6d81255abf939d94817596fd66b50 /base
parentcac407bd57b7f7b3f9d85e1951a07d68f8400d0a (diff)
downloadchromium_src-89062d330ccdcf875842ae679d59a9fcd8d14b65.zip
chromium_src-89062d330ccdcf875842ae679d59a9fcd8d14b65.tar.gz
chromium_src-89062d330ccdcf875842ae679d59a9fcd8d14b65.tar.bz2
Review URL: http://codereview.chromium.org/8220
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/message_pump_glib.cc11
-rw-r--r--base/message_pump_glib.h3
2 files changed, 9 insertions, 5 deletions
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index 603c80ea..f837f597 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -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() {
diff --git a/base/message_pump_glib.h b/base/message_pump_glib.h
index 97daa8a..01cd4b6 100644
--- a/base/message_pump_glib.h
+++ b/base/message_pump_glib.h
@@ -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);
};