diff options
author | skyostil <skyostil@chromium.org> | 2015-06-12 11:21:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-12 18:22:20 +0000 |
commit | a3899866682a1e846fc978368b00531a0e21d266 (patch) | |
tree | ca4ac5fd794e239361dabdca6aafcc830d927102 /win8 | |
parent | b2134362e27459f1098a35effedad91e2d553192 (diff) | |
download | chromium_src-a3899866682a1e846fc978368b00531a0e21d266.zip chromium_src-a3899866682a1e846fc978368b00531a0e21d266.tar.gz chromium_src-a3899866682a1e846fc978368b00531a0e21d266.tar.bz2 |
Remove remaining use of the deprecated MessageLoopProxy
This patch removes the remaining usage of MessageLoopProxy outside
base/. Note that there are still some call sites for
Thread::message_loop_proxy() and MessageLoop::message_loop_proxy() which
will be cleaned up separately.
BUG=465354
Review URL: https://codereview.chromium.org/1169923009
Cr-Commit-Position: refs/heads/master@{#334198}
Diffstat (limited to 'win8')
-rw-r--r-- | win8/metro_driver/chrome_app_view.cc | 26 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view.h | 2 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 93 |
3 files changed, 55 insertions, 66 deletions
diff --git a/win8/metro_driver/chrome_app_view.cc b/win8/metro_driver/chrome_app_view.cc index 87cdf37..4c5a8be 100644 --- a/win8/metro_driver/chrome_app_view.cc +++ b/win8/metro_driver/chrome_app_view.cc @@ -157,7 +157,7 @@ void MetroExit(bool send_alt_f4_mnemonic) { DWORD core_window_thread_id = GetWindowThreadProcessId( globals.view->core_window_hwnd(), &core_window_process_id); if (core_window_thread_id != ::GetCurrentThreadId()) { - globals.appview_msg_loop->PostDelayedTask( + globals.appview_task_runner->PostDelayedTask( FROM_HERE, base::Bind(&MetroExit, false), base::TimeDelta::FromMilliseconds(100)); @@ -428,7 +428,7 @@ void UnsnapHelper() { extern "C" __declspec(dllexport) void MetroUnsnap() { DVLOG(1) << __FUNCTION__; - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind(&UnsnapHelper)); } @@ -441,7 +441,7 @@ HWND GetRootWindow() { extern "C" __declspec(dllexport) void SetFrameWindow(HWND hwnd) { DVLOG(1) << __FUNCTION__ << ", hwnd=" << LONG_PTR(hwnd); - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind(&SetFrameWindowInternal, hwnd)); } @@ -454,7 +454,7 @@ extern "C" __declspec(dllexport) // This is a hack to ensure that the BrowserViewLayout code layout happens // just at the right time to hide the switcher button if it is visible. - globals.appview_msg_loop->PostDelayedTask( + globals.appview_task_runner->PostDelayedTask( FROM_HERE, base::Bind(&CloseFrameWindowInternal, hwnd), base::TimeDelta::FromMilliseconds(50)); } @@ -504,7 +504,7 @@ base::win::MetroLaunchType GetLaunchType( extern "C" __declspec(dllexport) void FlipFrameWindows() { DVLOG(1) << __FUNCTION__; - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind(&FlipFrameWindowsInternal)); } @@ -527,7 +527,7 @@ void DisplayNotification(const char* origin_url, const char* icon_url, notification_id, handler, handler_context); - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind(&ChromeAppView::DisplayNotification, globals.view, notification)); } @@ -543,7 +543,7 @@ bool CancelNotification(const char* notification_id) { return false; } - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind(&ChromeAppView::CancelNotification, globals.view, std::string(notification_id))); return true; @@ -585,7 +585,7 @@ void ShowDialogBox( dialog_box_info.button1_handler = button1_handler; dialog_box_info.button2_handler = button2_handler; - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind( &ChromeAppView::ShowDialogBox, globals.view, dialog_box_info)); } @@ -596,7 +596,7 @@ extern "C" __declspec(dllexport) void DismissDialogBox() { VLOG(1) << __FUNCTION__; - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind( &ChromeAppView::DismissDialogBox, globals.view)); @@ -606,7 +606,7 @@ extern "C" __declspec(dllexport) void SetFullscreen(bool fullscreen) { VLOG(1) << __FUNCTION__; - globals.appview_msg_loop->PostTask( + globals.appview_task_runner->PostTask( FROM_HERE, base::Bind( &ChromeAppView::SetFullscreen, globals.view, fullscreen)); @@ -821,8 +821,8 @@ ChromeAppView::Run() { // Create a message loop to allow message passing into this thread. base::MessageLoopForUI msg_loop; - // Announce our message loop to the world. - globals.appview_msg_loop = msg_loop.message_loop_proxy(); + // Announce our message loop task runner to the world. + globals.appview_task_runner = msg_loop.task_runner(); // And post the task that'll do the inner Metro message pumping to it. msg_loop.PostTask(FROM_HERE, base::Bind(&RunMessageLoop, dispatcher.Get())); @@ -840,7 +840,7 @@ ChromeAppView::Run() { msg_loop.Run(); - globals.appview_msg_loop = NULL; + globals.appview_task_runner = NULL; DVLOG(0) << "ProcessEvents done, hr=" << hr; diff --git a/win8/metro_driver/chrome_app_view.h b/win8/metro_driver/chrome_app_view.h index 77d6781..2620d008 100644 --- a/win8/metro_driver/chrome_app_view.h +++ b/win8/metro_driver/chrome_app_view.h @@ -162,7 +162,7 @@ struct Globals { bool is_initial_activation; // This message loop lives in the app view's thread. Some operations have // to be initiated from that thread, notably spawning file pickers. - base::MessageLoopProxy* appview_msg_loop; + base::SingleThreadTaskRunner* appview_task_runner; winapp::Core::ICoreApplicationExit* app_exit; base::string16 metro_command_line_switches; }; diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 3665760..8fac81c 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -14,6 +14,7 @@ #include "base/files/file_path.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" +#include "base/single_thread_task_runner.h" #include "base/win/metro.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" @@ -143,8 +144,7 @@ void SendKeySequence( class ChromeChannelListener : public IPC::Listener { public: ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) - : ui_proxy_(ui_loop->message_loop_proxy()), - app_view_(app_view) {} + : ui_task_runner_(ui_loop->task_runner()), app_view_(app_view) {} bool OnMessageReceived(const IPC::Message& message) override { IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) @@ -172,13 +172,15 @@ class ChromeChannelListener : public IPC::Listener { void OnChannelError() override { DVLOG(1) << "Channel error. Exiting."; - ui_proxy_->PostTask(FROM_HERE, + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), TERMINATE_USING_KEY_SEQUENCE)); // In early Windows 8 versions the code above sometimes fails so we call // it a second time with a NULL window which just calls Exit(). - ui_proxy_->PostDelayedTask(FROM_HERE, + ui_task_runner_->PostDelayedTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), TERMINATE_USING_PROCESS_EXIT), base::TimeDelta::FromMilliseconds(100)); @@ -186,91 +188,78 @@ class ChromeChannelListener : public IPC::Listener { private: void OnActivateDesktop(const base::FilePath& shortcut, bool ash_exit) { - ui_proxy_->PostTask(FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnActivateDesktop, - base::Unretained(app_view_), - shortcut, ash_exit)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnActivateDesktop, + base::Unretained(app_view_), shortcut, ash_exit)); } void OnMetroExit() { - ui_proxy_->PostTask(FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnMetroExit, - base::Unretained(app_view_), TERMINATE_USING_KEY_SEQUENCE)); + ui_task_runner_->PostTask( + FROM_HERE, + base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), + TERMINATE_USING_KEY_SEQUENCE)); } void OnOpenURLOnDesktop(const base::FilePath& shortcut, const base::string16& url) { - ui_proxy_->PostTask(FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, - base::Unretained(app_view_), - shortcut, url)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, + base::Unretained(app_view_), shortcut, url)); } void OnSetCursor(int64 cursor) { - ui_proxy_->PostTask(FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnSetCursor, - base::Unretained(app_view_), - reinterpret_cast<HCURSOR>(cursor))); + ui_task_runner_->PostTask( + FROM_HERE, + base::Bind(&ChromeAppViewAsh::OnSetCursor, base::Unretained(app_view_), + reinterpret_cast<HCURSOR>(cursor))); } void OnDisplayFileOpenDialog(const base::string16& title, const base::string16& filter, const base::FilePath& default_path, bool allow_multiple_files) { - ui_proxy_->PostTask(FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnDisplayFileOpenDialog, - base::Unretained(app_view_), - title, - filter, - default_path, - allow_multiple_files)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnDisplayFileOpenDialog, + base::Unretained(app_view_), title, filter, + default_path, allow_multiple_files)); } void OnDisplayFileSaveAsDialog( const MetroViewerHostMsg_SaveAsDialogParams& params) { - ui_proxy_->PostTask( - FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnDisplayFileSaveAsDialog, - base::Unretained(app_view_), - params)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnDisplayFileSaveAsDialog, + base::Unretained(app_view_), params)); } void OnDisplayFolderPicker(const base::string16& title) { - ui_proxy_->PostTask( - FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnDisplayFolderPicker, - base::Unretained(app_view_), - title)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnDisplayFolderPicker, + base::Unretained(app_view_), title)); } void OnSetCursorPos(int x, int y) { VLOG(1) << "In IPC OnSetCursorPos: " << x << ", " << y; - ui_proxy_->PostTask( - FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnSetCursorPos, - base::Unretained(app_view_), - x, y)); + ui_task_runner_->PostTask(FROM_HERE, + base::Bind(&ChromeAppViewAsh::OnSetCursorPos, + base::Unretained(app_view_), x, y)); } void OnImeCancelComposition() { - ui_proxy_->PostTask( - FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnImeCancelComposition, - base::Unretained(app_view_))); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeCancelComposition, + base::Unretained(app_view_))); } void OnImeTextInputClientChanged( const std::vector<int32>& input_scopes, const std::vector<metro_viewer::CharacterBounds>& character_bounds) { - ui_proxy_->PostTask( - FROM_HERE, - base::Bind(&ChromeAppViewAsh::OnImeUpdateTextInputClient, - base::Unretained(app_view_), - input_scopes, - character_bounds)); + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeUpdateTextInputClient, + base::Unretained(app_view_), input_scopes, + character_bounds)); } - scoped_refptr<base::MessageLoopProxy> ui_proxy_; + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; ChromeAppViewAsh* app_view_; }; |