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

Side by Side Diff: base/message_pump_glib.cc

Issue 18677: Use PlatformThreadId, not int when dealing with thread ids. (Closed)
Patch Set: Addressing comments Created 11 years, 11 months 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
« no previous file with comments | « no previous file | base/non_thread_safe.h » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 g_source_destroy(work_source_); 115 g_source_destroy(work_source_);
116 g_source_unref(work_source_); 116 g_source_unref(work_source_);
117 close(wakeup_pipe_read_); 117 close(wakeup_pipe_read_);
118 close(wakeup_pipe_write_); 118 close(wakeup_pipe_write_);
119 } 119 }
120 120
121 void MessagePumpForUI::Run(Delegate* delegate) { 121 void MessagePumpForUI::Run(Delegate* delegate) {
122 #ifndef NDEBUG 122 #ifndef NDEBUG
123 // Make sure we only run this on one thread. GTK only has one message pump 123 // Make sure we only run this on one thread. GTK only has one message pump
124 // so we can only have one UI loop per process. 124 // so we can only have one UI loop per process.
125 static int thread_id = PlatformThread::CurrentId(); 125 static PlatformThreadId thread_id = PlatformThread::CurrentId();
126 DCHECK(thread_id == PlatformThread::CurrentId()) << 126 DCHECK(thread_id == PlatformThread::CurrentId()) <<
127 "Running MessagePumpForUI on two different threads; " 127 "Running MessagePumpForUI on two different threads; "
128 "this is unsupported by GLib!"; 128 "this is unsupported by GLib!";
129 #endif 129 #endif
130 130
131 RunState state; 131 RunState state;
132 state.delegate = delegate; 132 state.delegate = delegate;
133 state.should_quit = false; 133 state.should_quit = false;
134 state.run_depth = state_ ? state_->run_depth + 1 : 1; 134 state.run_depth = state_ ? state_->run_depth + 1 : 1;
135 // We really only do a single task for each iteration of the loop. If we 135 // We really only do a single task for each iteration of the loop. If we
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) { 230 void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) {
231 // We need to wake up the loop in case the poll timeout needs to be 231 // We need to wake up the loop in case the poll timeout needs to be
232 // adjusted. This will cause us to try to do work, but that's ok. 232 // adjusted. This will cause us to try to do work, but that's ok.
233 delayed_work_time_ = delayed_work_time; 233 delayed_work_time_ = delayed_work_time;
234 ScheduleWork(); 234 ScheduleWork();
235 } 235 }
236 236
237 } // namespace base 237 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/non_thread_safe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698