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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate_win.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (!appbar_autohide_edge_map_.count(monitor)) 160 if (!appbar_autohide_edge_map_.count(monitor))
161 appbar_autohide_edge_map_[monitor] = EDGE_BOTTOM; 161 appbar_autohide_edge_map_[monitor] = EDGE_BOTTOM;
162 162
163 // We use the SHAppBarMessage API to get the taskbar autohide state. This API 163 // We use the SHAppBarMessage API to get the taskbar autohide state. This API
164 // spins a modal loop which could cause callers to be reentered. To avoid 164 // spins a modal loop which could cause callers to be reentered. To avoid
165 // that we retrieve the taskbar state in a worker thread. 165 // that we retrieve the taskbar state in a worker thread.
166 if (monitor && !in_autohide_edges_callback_) { 166 if (monitor && !in_autohide_edges_callback_) {
167 // TODO(robliao): Annotate this task with .WithCOM() once supported. 167 // TODO(robliao): Annotate this task with .WithCOM() once supported.
168 // https://crbug.com/662122 168 // https://crbug.com/662122
169 base::PostTaskWithTraitsAndReplyWithResult( 169 base::PostTaskWithTraitsAndReplyWithResult(
170 FROM_HERE, 170 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
171 base::TaskTraits().MayBlock().WithPriority(
172 base::TaskPriority::USER_BLOCKING),
173 base::Bind(&GetAppbarAutohideEdgesOnWorkerThread, monitor), 171 base::Bind(&GetAppbarAutohideEdgesOnWorkerThread, monitor),
174 base::Bind(&ChromeViewsDelegate::OnGotAppbarAutohideEdges, 172 base::Bind(&ChromeViewsDelegate::OnGotAppbarAutohideEdges,
175 weak_factory_.GetWeakPtr(), callback, monitor, 173 weak_factory_.GetWeakPtr(), callback, monitor,
176 appbar_autohide_edge_map_[monitor])); 174 appbar_autohide_edge_map_[monitor]));
177 } 175 }
178 return appbar_autohide_edge_map_[monitor]; 176 return appbar_autohide_edge_map_[monitor];
179 } 177 }
180 178
181 void ChromeViewsDelegate::OnGotAppbarAutohideEdges( 179 void ChromeViewsDelegate::OnGotAppbarAutohideEdges(
182 const base::Closure& callback, 180 const base::Closure& callback,
183 HMONITOR monitor, 181 HMONITOR monitor,
184 int returned_edges, 182 int returned_edges,
185 int edges) { 183 int edges) {
186 appbar_autohide_edge_map_[monitor] = edges; 184 appbar_autohide_edge_map_[monitor] = edges;
187 if (returned_edges == edges) 185 if (returned_edges == edges)
188 return; 186 return;
189 187
190 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); 188 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true);
191 callback.Run(); 189 callback.Run();
192 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698