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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 2049493004: Remove use of deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « ui/views/widget/widget_interactive_uitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index f20524e60ae1e585feae4a7ace8576aef4fbe00e..d8c14ee9b2776f12091f4af804e3da9a69df6ff0 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -14,7 +14,10 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/debug/alias.h"
+#include "base/location.h"
#include "base/macros.h"
+#include "base/single_thread_task_runner.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/windows_version.h"
@@ -422,7 +425,7 @@ void HWNDMessageHandler::Close() {
// may delete ourselves on destroy and the ATL callback would still
// dereference us when the callback returns).
waiting_for_close_now_ = true;
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&HWNDMessageHandler::CloseNow, weak_factory_.GetWeakPtr()));
}
@@ -1252,11 +1255,9 @@ void HWNDMessageHandler::ForceRedrawWindow(int attempts) {
// unavailable.
if (--attempts <= 0)
return;
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&HWNDMessageHandler::ForceRedrawWindow,
- weak_factory_.GetWeakPtr(),
- attempts),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::Bind(&HWNDMessageHandler::ForceRedrawWindow,
+ weak_factory_.GetWeakPtr(), attempts),
base::TimeDelta::FromMilliseconds(500));
return;
}
@@ -2115,7 +2116,7 @@ void HWNDMessageHandler::OnSize(UINT param, const gfx::Size& size) {
// don't get nested WM_SIZE messages.
if (needs_scroll_styles_ && !in_size_loop_) {
ShowScrollBar(hwnd(), SB_BOTH, FALSE);
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&AddScrollStylesToWindow, hwnd()));
}
}
@@ -2227,10 +2228,9 @@ LRESULT HWNDMessageHandler::OnTouchEvent(UINT message,
GenerateTouchEvent(ui::ET_TOUCH_PRESSED, touch_point, touch_id,
event_time, &touch_events);
touch_down_contexts_++;
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&HWNDMessageHandler::ResetTouchDownContext,
- weak_factory_.GetWeakPtr()),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::Bind(&HWNDMessageHandler::ResetTouchDownContext,
+ weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kTouchDownContextResetTimeout));
} else {
if (input[i].dwFlags & TOUCHEVENTF_MOVE) {
@@ -2249,10 +2249,9 @@ LRESULT HWNDMessageHandler::OnTouchEvent(UINT message,
// Handle the touch events asynchronously. We need this because touch
// events on windows don't fire if we enter a modal loop in the context of
// a touch event.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&HWNDMessageHandler::HandleTouchEvents,
- weak_factory_.GetWeakPtr(), touch_events));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&HWNDMessageHandler::HandleTouchEvents,
+ weak_factory_.GetWeakPtr(), touch_events));
}
CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(l_param));
SetMsgHandled(FALSE);
@@ -2320,10 +2319,9 @@ void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
// likes to (incorrectly) recalculate what our position/size should be
// and send us further updates.
ignore_window_pos_changes_ = true;
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&HWNDMessageHandler::StopIgnoringPosChanges,
- weak_factory_.GetWeakPtr()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&HWNDMessageHandler::StopIgnoringPosChanges,
+ weak_factory_.GetWeakPtr()));
}
last_monitor_ = monitor;
last_monitor_rect_ = monitor_rect;
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698