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

Side by Side Diff: chrome/browser/ui/views/status_icons/status_tray_win.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/status_icons/status_tray_win.h" 5 #include "chrome/browser/ui/views/status_icons/status_tray_win.h"
6 6
7 #include <commctrl.h> 7 #include <commctrl.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 weak_factory_(this) { 69 weak_factory_(this) {
70 worker_thread_.init_com_with_mta(false); 70 worker_thread_.init_com_with_mta(false);
71 } 71 }
72 72
73 void EnqueueChange(UINT icon_id, HWND window) override { 73 void EnqueueChange(UINT icon_id, HWND window) override {
74 DCHECK(CalledOnValidThread()); 74 DCHECK(CalledOnValidThread());
75 if (pending_requests_ == 0) 75 if (pending_requests_ == 0)
76 worker_thread_.Start(); 76 worker_thread_.Start();
77 77
78 ++pending_requests_; 78 ++pending_requests_;
79 worker_thread_.message_loop_proxy()->PostTaskAndReply( 79 worker_thread_.task_runner()->PostTaskAndReply(
msw 2015/06/10 00:12:57 Should this file include location.h and single_thr
Sami 2015/06/10 12:35:34 Yes, well spotted, thanks. The automated rewriting
80 FROM_HERE, 80 FROM_HERE,
81 base::Bind( 81 base::Bind(
82 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread, 82 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread,
83 icon_id, 83 icon_id, window),
84 window),
85 base::Bind(&StatusTrayStateChangerProxyImpl::ChangeDone, 84 base::Bind(&StatusTrayStateChangerProxyImpl::ChangeDone,
86 weak_factory_.GetWeakPtr())); 85 weak_factory_.GetWeakPtr()));
87 } 86 }
88 87
89 private: 88 private:
90 // Must be called only on |worker_thread_|, to ensure the correct COM 89 // Must be called only on |worker_thread_|, to ensure the correct COM
91 // apartment. 90 // apartment.
92 static void EnqueueChangeOnWorkerThread(UINT icon_id, HWND window) { 91 static void EnqueueChangeOnWorkerThread(UINT icon_id, HWND window) {
93 // It appears that IUnknowns are coincidentally compatible with 92 // It appears that IUnknowns are coincidentally compatible with
94 // scoped_refptr. Normally I wouldn't depend on that but it seems that 93 // scoped_refptr. Normally I wouldn't depend on that but it seems that
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 255 }
257 256
258 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( 257 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest(
259 scoped_ptr<StatusTrayStateChangerProxy> proxy) { 258 scoped_ptr<StatusTrayStateChangerProxy> proxy) {
260 state_changer_proxy_ = proxy.Pass(); 259 state_changer_proxy_ = proxy.Pass();
261 } 260 }
262 261
263 StatusTray* StatusTray::Create() { 262 StatusTray* StatusTray::Create() {
264 return new StatusTrayWin(); 263 return new StatusTrayWin();
265 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698