summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 05:29:49 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 05:29:49 +0000
commitb9f12d8f46479f3919df8c65380309f48c0ea728 (patch)
treed930355ec3c9c6d9ff6587d31426727d9cff0382
parent28468a56edca65ebd3679d808fe825124f358672 (diff)
downloadchromium_src-b9f12d8f46479f3919df8c65380309f48c0ea728.zip
chromium_src-b9f12d8f46479f3919df8c65380309f48c0ea728.tar.gz
chromium_src-b9f12d8f46479f3919df8c65380309f48c0ea728.tar.bz2
message-loop: Remove MessagePumpDispatcher support from glib message-pump.
MessagePumpDispatcher is no longer used in the glib message-pump. So remove the relevant unused code. BUG=354062 R=darin@chromium.org Review URL: https://codereview.chromium.org/236363018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264121 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/message_loop/message_loop_unittest.cc2
-rw-r--r--base/message_loop/message_pump_glib.cc119
-rw-r--r--base/message_loop/message_pump_glib.h23
-rw-r--r--base/run_loop.cc2
-rw-r--r--base/run_loop.h2
-rw-r--r--ui/aura/env.cc4
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_aurax11.h1
-rw-r--r--ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc1
8 files changed, 58 insertions, 96 deletions
diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc
index 7ccee73..1b09eb0 100644
--- a/base/message_loop/message_loop_unittest.cc
+++ b/base/message_loop/message_loop_unittest.cc
@@ -12,7 +12,6 @@
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy_impl.h"
#include "base/message_loop/message_loop_test.h"
-#include "base/message_loop/message_pump_dispatcher.h"
#include "base/pending_task.h"
#include "base/posix/eintr_wrapper.h"
#include "base/run_loop.h"
@@ -23,6 +22,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
+#include "base/message_loop/message_pump_dispatcher.h"
#include "base/message_loop/message_pump_win.h"
#include "base/process/memory.h"
#include "base/strings/string16.h"
diff --git a/base/message_loop/message_pump_glib.cc b/base/message_loop/message_pump_glib.cc
index 3da5f56..873d496 100644
--- a/base/message_loop/message_pump_glib.cc
+++ b/base/message_loop/message_pump_glib.cc
@@ -121,7 +121,6 @@ GSourceFuncs WorkSourceFuncs = {
struct MessagePumpGlib::RunState {
Delegate* delegate;
- MessagePumpDispatcher* dispatcher;
// Used to flag that the current Run() invocation should return ASAP.
bool should_quit;
@@ -167,65 +166,6 @@ MessagePumpGlib::~MessagePumpGlib() {
close(wakeup_pipe_write_);
}
-void MessagePumpGlib::RunWithDispatcher(Delegate* delegate,
- MessagePumpDispatcher* dispatcher) {
-#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 PlatformThreadId thread_id = PlatformThread::CurrentId();
- DCHECK(thread_id == PlatformThread::CurrentId()) <<
- "Running MessagePumpGlib on two different threads; "
- "this is unsupported by GLib!";
-#endif
-
- RunState state;
- state.delegate = delegate;
- state.dispatcher = dispatcher;
- state.should_quit = false;
- state.run_depth = state_ ? state_->run_depth + 1 : 1;
- state.has_work = false;
-
- RunState* previous_state = state_;
- state_ = &state;
-
- // We really only do a single task for each iteration of the loop. If we
- // have done something, assume there is likely something more to do. This
- // will mean that we don't block on the message pump until there was nothing
- // more to do. We also set this to true to make sure not to block on the
- // first iteration of the loop, so RunUntilIdle() works correctly.
- bool more_work_is_plausible = true;
-
- // We run our own loop instead of using g_main_loop_quit in one of the
- // callbacks. This is so we only quit our own loops, and we don't quit
- // nested loops run by others. TODO(deanm): Is this what we want?
- for (;;) {
- // Don't block if we think we have more work to do.
- bool block = !more_work_is_plausible;
-
- more_work_is_plausible = g_main_context_iteration(context_, block);
- if (state_->should_quit)
- break;
-
- more_work_is_plausible |= state_->delegate->DoWork();
- if (state_->should_quit)
- break;
-
- more_work_is_plausible |=
- state_->delegate->DoDelayedWork(&delayed_work_time_);
- if (state_->should_quit)
- break;
-
- if (more_work_is_plausible)
- continue;
-
- more_work_is_plausible = state_->delegate->DoIdleWork();
- if (state_->should_quit)
- break;
- }
-
- state_ = previous_state;
-}
-
// Return the timeout we want passed to poll.
int MessagePumpGlib::HandlePrepare() {
// We know we have work, but we haven't called HandleDispatch yet. Don't let
@@ -291,7 +231,60 @@ void MessagePumpGlib::HandleDispatch() {
}
void MessagePumpGlib::Run(Delegate* delegate) {
- RunWithDispatcher(delegate, NULL);
+#ifndef NDEBUG
+ // Make sure we only run this on one thread. X only has one message pump
+ // so we can only have one UI loop per process.
+ static PlatformThreadId thread_id = PlatformThread::CurrentId();
+ DCHECK(thread_id == PlatformThread::CurrentId()) <<
+ "Running MessagePumpGlib on two different threads; "
+ "this is unsupported by GLib!";
+#endif
+
+ RunState state;
+ state.delegate = delegate;
+ state.should_quit = false;
+ state.run_depth = state_ ? state_->run_depth + 1 : 1;
+ state.has_work = false;
+
+ RunState* previous_state = state_;
+ state_ = &state;
+
+ // We really only do a single task for each iteration of the loop. If we
+ // have done something, assume there is likely something more to do. This
+ // will mean that we don't block on the message pump until there was nothing
+ // more to do. We also set this to true to make sure not to block on the
+ // first iteration of the loop, so RunUntilIdle() works correctly.
+ bool more_work_is_plausible = true;
+
+ // We run our own loop instead of using g_main_loop_quit in one of the
+ // callbacks. This is so we only quit our own loops, and we don't quit
+ // nested loops run by others. TODO(deanm): Is this what we want?
+ for (;;) {
+ // Don't block if we think we have more work to do.
+ bool block = !more_work_is_plausible;
+
+ more_work_is_plausible = g_main_context_iteration(context_, block);
+ if (state_->should_quit)
+ break;
+
+ more_work_is_plausible |= state_->delegate->DoWork();
+ if (state_->should_quit)
+ break;
+
+ more_work_is_plausible |=
+ state_->delegate->DoDelayedWork(&delayed_work_time_);
+ if (state_->should_quit)
+ break;
+
+ if (more_work_is_plausible)
+ continue;
+
+ more_work_is_plausible = state_->delegate->DoIdleWork();
+ if (state_->should_quit)
+ break;
+ }
+
+ state_ = previous_state;
}
void MessagePumpGlib::Quit() {
@@ -319,10 +312,6 @@ void MessagePumpGlib::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
ScheduleWork();
}
-MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() {
- return state_ ? state_->dispatcher : NULL;
-}
-
bool MessagePumpGlib::ShouldQuit() const {
CHECK(state_);
return state_->should_quit;
diff --git a/base/message_loop/message_pump_glib.h b/base/message_loop/message_pump_glib.h
index 5082db3..179e264 100644
--- a/base/message_loop/message_pump_glib.h
+++ b/base/message_loop/message_pump_glib.h
@@ -17,19 +17,6 @@ typedef struct _GSource GSource;
namespace base {
-// MessagePumpObserver is notified prior to an event being dispatched. As
-// Observers are notified of every change, they have to be FAST! The platform
-// specific implementation of the class is in message_pump_x.
-class MessagePumpObserver;
-
-// MessagePumpDispatcher is used during a nested invocation of Run to dispatch
-// events. If Run is invoked with a non-NULL MessagePumpDispatcher, MessageLoop
-// does not dispatch events (or invoke gtk_main_do_event), rather every event is
-// passed to Dispatcher's Dispatch method for dispatch. It is up to the
-// Dispatcher to dispatch, or not, the event. The platform specific
-// implementation of the class is in message_pump_x.
-class MessagePumpDispatcher;
-
// This class implements a base MessagePump needed for TYPE_UI MessageLoops on
// platforms using GLib.
class BASE_EXPORT MessagePumpGlib : public MessagePump {
@@ -37,10 +24,6 @@ class BASE_EXPORT MessagePumpGlib : public MessagePump {
MessagePumpGlib();
virtual ~MessagePumpGlib();
- // Like MessagePump::Run, but events are routed through dispatcher.
- virtual void RunWithDispatcher(Delegate* delegate,
- MessagePumpDispatcher* dispatcher);
-
// Internal methods used for processing the pump callbacks. They are
// public for simplicity but should not be used directly. HandlePrepare
// is called during the prepare step of glib, and returns a timeout that
@@ -57,13 +40,9 @@ class BASE_EXPORT MessagePumpGlib : public MessagePump {
virtual void ScheduleWork() OVERRIDE;
virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;
- protected:
- // Returns the dispatcher for the current run state (|state_->dispatcher|).
- MessagePumpDispatcher* GetDispatcher();
-
+ private:
bool ShouldQuit() const;
- private:
// We may make recursive calls to Run, so we save state that needs to be
// separate between them in this structure type.
struct RunState;
diff --git a/base/run_loop.cc b/base/run_loop.cc
index 663d623..8344aa4 100644
--- a/base/run_loop.cc
+++ b/base/run_loop.cc
@@ -6,7 +6,7 @@
#include "base/bind.h"
-#if defined(USE_AURA)
+#if defined(OS_WIN)
#include "base/message_loop/message_pump_dispatcher.h"
#endif
diff --git a/base/run_loop.h b/base/run_loop.h
index 71703f0..0024108 100644
--- a/base/run_loop.h
+++ b/base/run_loop.h
@@ -15,7 +15,7 @@ namespace base {
class MessagePumpForUI;
#endif
-#if defined(USE_AURA)
+#if defined(OS_WIN)
class MessagePumpDispatcher;
#endif
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 7e25c4c..61b7f27 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -4,13 +4,9 @@
#include "ui/aura/env.h"
-#include "base/command_line.h"
-#include "base/message_loop/message_pump_dispatcher.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/input_state_lookup.h"
-#include "ui/aura/window.h"
#include "ui/compositor/compositor.h"
-#include "ui/compositor/compositor_switches.h"
#include "ui/events/event_target_iterator.h"
namespace aura {
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.h b/ui/base/dragdrop/os_exchange_data_provider_aurax11.h
index 54ca445..702cc7e 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aurax11.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11.h
@@ -13,7 +13,6 @@
#include <map>
#include "base/files/file_path.h"
-#include "base/message_loop/message_pump_dispatcher.h"
#include "base/pickle.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/x/selection_owner.h"
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index 9dc300b..39b6cda 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -9,7 +9,6 @@
#include "base/event_types.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_pump_dispatcher.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/clipboard/clipboard.h"