Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: base/message_pump_glib.cc

Issue 8351025: Revert 107042 - Replace most LOG/CHECK statements with DLOG/DCHECK statements in base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_libevent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_glib.h" 5 #include "base/message_pump_glib.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <glib.h> 10 #include <glib.h>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // we get it, we keep that state here to stay consistent. 138 // we get it, we keep that state here to stay consistent.
139 bool has_work; 139 bool has_work;
140 }; 140 };
141 141
142 MessagePumpGlib::MessagePumpGlib() 142 MessagePumpGlib::MessagePumpGlib()
143 : state_(NULL), 143 : state_(NULL),
144 context_(g_main_context_default()), 144 context_(g_main_context_default()),
145 wakeup_gpollfd_(new GPollFD) { 145 wakeup_gpollfd_(new GPollFD) {
146 // Create our wakeup pipe, which is used to flag when work was scheduled. 146 // Create our wakeup pipe, which is used to flag when work was scheduled.
147 int fds[2]; 147 int fds[2];
148 int ret = pipe(fds); 148 CHECK_EQ(pipe(fds), 0);
149 DCHECK_EQ(ret, 0);
150 (void)ret; // Prevent warning in release mode.
151
152 wakeup_pipe_read_ = fds[0]; 149 wakeup_pipe_read_ = fds[0];
153 wakeup_pipe_write_ = fds[1]; 150 wakeup_pipe_write_ = fds[1];
154 wakeup_gpollfd_->fd = wakeup_pipe_read_; 151 wakeup_gpollfd_->fd = wakeup_pipe_read_;
155 wakeup_gpollfd_->events = G_IO_IN; 152 wakeup_gpollfd_->events = G_IO_IN;
156 153
157 work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource)); 154 work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource));
158 static_cast<WorkSource*>(work_source_)->pump = this; 155 static_cast<WorkSource*>(work_source_)->pump = this;
159 g_source_add_poll(work_source_, wakeup_gpollfd_.get()); 156 g_source_add_poll(work_source_, wakeup_gpollfd_.get());
160 // Use a low priority so that we let other events in the queue go first. 157 // Use a low priority so that we let other events in the queue go first.
161 g_source_set_priority(work_source_, G_PRIORITY_DEFAULT_IDLE); 158 g_source_set_priority(work_source_, G_PRIORITY_DEFAULT_IDLE);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // adjusted. This will cause us to try to do work, but that's ok. 321 // adjusted. This will cause us to try to do work, but that's ok.
325 delayed_work_time_ = delayed_work_time; 322 delayed_work_time_ = delayed_work_time;
326 ScheduleWork(); 323 ScheduleWork();
327 } 324 }
328 325
329 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() { 326 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() {
330 return state_ ? state_->dispatcher : NULL; 327 return state_ ? state_->dispatcher : NULL;
331 } 328 }
332 329
333 } // namespace base 330 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698