asargent | 631a99a | 2015-10-15 21:51:48 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "extensions/browser/updater/update_client_config.h" |
| 6 | |
Gabriel Charette | 5ff87ce | 2017-05-16 18:03:45 | [diff] [blame] | 7 | #include "base/sequenced_task_runner.h" |
fdoray | 1d795c1 | 2017-04-25 13:31:27 | [diff] [blame] | 8 | #include "base/task_scheduler/post_task.h" |
Robert Liao | dc4bd37 | 2017-07-10 18:24:58 | [diff] [blame] | 9 | #include "base/task_scheduler/task_traits.h" |
| 10 | #include "build/build_config.h" |
asargent | 631a99a | 2015-10-15 21:51:48 | [diff] [blame] | 11 | |
| 12 | namespace extensions { |
| 13 | |
| 14 | UpdateClientConfig::UpdateClientConfig() {} |
| 15 | |
| 16 | scoped_refptr<base::SequencedTaskRunner> |
| 17 | UpdateClientConfig::GetSequencedTaskRunner() const { |
Robert Liao | dc4bd37 | 2017-07-10 18:24:58 | [diff] [blame] | 18 | constexpr base::TaskTraits traits = { |
| 19 | base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 20 | base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}; |
| 21 | #if defined(OS_WIN) |
| 22 | // Use the COM STA task runner as the Windows background downloader requires |
| 23 | // COM initialization. |
| 24 | return base::CreateCOMSTATaskRunnerWithTraits(traits); |
| 25 | #else |
| 26 | return base::CreateSequencedTaskRunnerWithTraits(traits); |
| 27 | #endif |
asargent | 631a99a | 2015-10-15 21:51:48 | [diff] [blame] | 28 | } |
| 29 | |
asargent | 631a99a | 2015-10-15 21:51:48 | [diff] [blame] | 30 | UpdateClientConfig::~UpdateClientConfig() {} |
| 31 | |
| 32 | } // namespace extensions |