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

Unified Diff: base/message_loop/message_pump_glib.cc

Issue 17078005: Move message_pump to base/message_loop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop/message_pump_glib.h ('k') | base/message_loop/message_pump_glib_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_glib.cc
diff --git a/base/message_pump_glib.cc b/base/message_loop/message_pump_glib.cc
similarity index 97%
rename from base/message_pump_glib.cc
rename to base/message_loop/message_pump_glib.cc
index 7436558373e15fb604c725c5d9320e9f759ef132..de012fdddea5bfd7e517b8b037502d6e7df26e46 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_loop/message_pump_glib.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/message_pump_glib.h"
+#include "base/message_loop/message_pump_glib.h"
#include <fcntl.h>
#include <math.h>
@@ -13,11 +13,13 @@
#include "base/posix/eintr_wrapper.h"
#include "base/threading/platform_thread.h"
+namespace base {
+
namespace {
// Return a timeout suitable for the glib loop, -1 to block forever,
// 0 to return right away, or a timeout in milliseconds from now.
-int GetTimeIntervalMilliseconds(const base::TimeTicks& from) {
+int GetTimeIntervalMilliseconds(const TimeTicks& from) {
if (from.is_null())
return -1;
@@ -25,7 +27,7 @@ int GetTimeIntervalMilliseconds(const base::TimeTicks& from) {
// value in milliseconds. If there are 5.5ms left, should the delay be 5 or
// 6? It should be 6 to avoid executing delayed work too early.
int delay = static_cast<int>(
- ceil((from - base::TimeTicks::Now()).InMillisecondsF()));
+ ceil((from - TimeTicks::Now()).InMillisecondsF()));
// If this value is negative, then we need to run delayed work soon.
return delay < 0 ? 0 : delay;
@@ -81,7 +83,7 @@ int GetTimeIntervalMilliseconds(const base::TimeTicks& from) {
// loop, around event handling.
struct WorkSource : public GSource {
- base::MessagePumpGlib* pump;
+ MessagePumpGlib* pump;
};
gboolean WorkSourcePrepare(GSource* source,
@@ -117,9 +119,6 @@ GSourceFuncs WorkSourceFuncs = {
} // namespace
-
-namespace base {
-
struct MessagePumpGlib::RunState {
Delegate* delegate;
MessagePumpDispatcher* dispatcher;
@@ -166,8 +165,8 @@ void MessagePumpGlib::RunWithDispatcher(Delegate* delegate,
#ifndef NDEBUG
// Make sure we only run this on one thread. X/GTK only has one message pump
// so we can only have one UI loop per process.
- static base::PlatformThreadId thread_id = base::PlatformThread::CurrentId();
- DCHECK(thread_id == base::PlatformThread::CurrentId()) <<
+ static PlatformThreadId thread_id = PlatformThread::CurrentId();
+ DCHECK(thread_id == PlatformThread::CurrentId()) <<
"Running MessagePumpGlib on two different threads; "
"this is unsupported by GLib!";
#endif
« no previous file with comments | « base/message_loop/message_pump_glib.h ('k') | base/message_loop/message_pump_glib_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698