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

Side by Side Diff: chrome/browser/shell_integration.cc

Issue 2916943002: Use SequencedTaskRunner where now possible after making Timer sequence-friendly. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shell_integration.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 27 matching lines...) Expand all
38 #endif 38 #endif
39 39
40 using content::BrowserThread; 40 using content::BrowserThread;
41 41
42 namespace shell_integration { 42 namespace shell_integration {
43 43
44 namespace { 44 namespace {
45 45
46 const struct AppModeInfo* gAppModeInfo = nullptr; 46 const struct AppModeInfo* gAppModeInfo = nullptr;
47 47
48 scoped_refptr<base::SequencedTaskRunner>
49 CreateTaskRunnerForDefaultWebClientWorker() {
50 #if defined(OS_WIN)
51 if (base::win::GetVersion() >= base::win::VERSION_WIN10)
52 // TODO(pmonette): Windows 10's implementation uses a base::Timer which
53 // currently still requires a SingleThreadTaskRunner. Change this to a
54 // SequencedTaskRunner when crbug.com/552633 is fixed.
55 return base::CreateSingleThreadTaskRunnerWithTraits({base::MayBlock()});
56 #endif // defined(OS_WIN)
57 return base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()});
58 }
59
60 } // namespace 48 } // namespace
61 49
62 bool CanSetAsDefaultBrowser() { 50 bool CanSetAsDefaultBrowser() {
63 return GetDefaultWebClientSetPermission() != SET_DEFAULT_NOT_ALLOWED; 51 return GetDefaultWebClientSetPermission() != SET_DEFAULT_NOT_ALLOWED;
64 } 52 }
65 53
66 #if !defined(OS_WIN) 54 #if !defined(OS_WIN)
67 bool IsElevationNeededForSettingDefaultProtocolClient() { 55 bool IsElevationNeededForSettingDefaultProtocolClient() {
68 return false; 56 return false;
69 } 57 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 DefaultWebClientWorker::GetTaskRunner() { 175 DefaultWebClientWorker::GetTaskRunner() {
188 DCHECK_CURRENTLY_ON(BrowserThread::UI); 176 DCHECK_CURRENTLY_ON(BrowserThread::UI);
189 177
190 // TODO(pmonette): The better way to make sure all instances of 178 // TODO(pmonette): The better way to make sure all instances of
191 // DefaultWebClient share a SequencedTaskRunner is to make the worker a 179 // DefaultWebClient share a SequencedTaskRunner is to make the worker a
192 // singleton. 180 // singleton.
193 static scoped_refptr<base::SequencedTaskRunner>* task_runner = nullptr; 181 static scoped_refptr<base::SequencedTaskRunner>* task_runner = nullptr;
194 182
195 if (!task_runner) { 183 if (!task_runner) {
196 task_runner = new scoped_refptr<base::SequencedTaskRunner>( 184 task_runner = new scoped_refptr<base::SequencedTaskRunner>(
197 CreateTaskRunnerForDefaultWebClientWorker()); 185 base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}));
198 } 186 }
199 187
200 return *task_runner; 188 return *task_runner;
201 } 189 }
202 190
203 void DefaultWebClientWorker::CheckIsDefault(bool is_following_set_as_default) { 191 void DefaultWebClientWorker::CheckIsDefault(bool is_following_set_as_default) {
204 base::ThreadRestrictions::AssertIOAllowed(); 192 base::ThreadRestrictions::AssertIOAllowed();
205 193
206 DefaultWebClientState state = CheckIsDefaultImpl(); 194 DefaultWebClientState state = CheckIsDefaultImpl();
207 BrowserThread::PostTask( 195 BrowserThread::PostTask(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return; 327 return;
340 } 328 }
341 } 329 }
342 #endif // defined(OS_WIN) 330 #endif // defined(OS_WIN)
343 break; 331 break;
344 } 332 }
345 on_finished_callback.Run(); 333 on_finished_callback.Run();
346 } 334 }
347 335
348 } // namespace shell_integration 336 } // namespace shell_integration
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698