summaryrefslogtreecommitdiffstats
path: root/base/message_pump_glib.cc
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 20:45:54 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 20:45:54 +0000
commit831a32d135fdeeea1f906742074f3b72312e9669 (patch)
treec692080f8a9a25101e9adca2c8c3797233bf1eb6 /base/message_pump_glib.cc
parentf16785b4bbd3449580e7998d83a80b0b2fb6dcd1 (diff)
downloadchromium_src-831a32d135fdeeea1f906742074f3b72312e9669.zip
chromium_src-831a32d135fdeeea1f906742074f3b72312e9669.tar.gz
chromium_src-831a32d135fdeeea1f906742074f3b72312e9669.tar.bz2
Avoid including gtk & glib headers in message_pump_glib.h, saves 1 sec on do-nothing make.
TEST=manual browser test, trybots BUG=none Review URL: http://codereview.chromium.org/464031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_glib.cc')
-rw-r--r--base/message_pump_glib.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index 6f050ba..29bc64e 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -7,6 +7,9 @@
#include <fcntl.h>
#include <math.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+
#include "base/eintr_wrapper.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -124,18 +127,19 @@ namespace base {
MessagePumpForUI::MessagePumpForUI()
: state_(NULL),
- context_(g_main_context_default()) {
+ context_(g_main_context_default()),
+ wakeup_gpollfd_(new GPollFD) {
// Create our wakeup pipe, which is used to flag when work was scheduled.
int fds[2];
CHECK(pipe(fds) == 0);
wakeup_pipe_read_ = fds[0];
wakeup_pipe_write_ = fds[1];
- wakeup_gpollfd_.fd = wakeup_pipe_read_;
- wakeup_gpollfd_.events = G_IO_IN;
+ wakeup_gpollfd_->fd = wakeup_pipe_read_;
+ wakeup_gpollfd_->events = G_IO_IN;
work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource));
static_cast<WorkSource*>(work_source_)->pump = this;
- g_source_add_poll(work_source_, &wakeup_gpollfd_);
+ g_source_add_poll(work_source_, wakeup_gpollfd_.get());
// Use a low priority so that we let other events in the queue go first.
g_source_set_priority(work_source_, G_PRIORITY_DEFAULT_IDLE);
// This is needed to allow Run calls inside Dispatch.
@@ -229,7 +233,7 @@ bool MessagePumpForUI::HandleCheck() {
// We should only ever have a single message on the wakeup pipe, since we
// are only signaled when the queue went from empty to non-empty. The glib
// poll will tell us whether there was data, so this read shouldn't block.
- if (wakeup_gpollfd_.revents & G_IO_IN) {
+ if (wakeup_gpollfd_->revents & G_IO_IN) {
char msg;
if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') {
NOTREACHED() << "Error reading from the wakeup pipe.";