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

Side by Side Diff: chrome/browser/component_updater/sw_reporter_installer_win.cc

Issue 2547693002: Use TaskScheduler instead of WorkerPool in sw_reporter_installer_win.cc. (Closed)
Patch Set: fix build error Created 4 years 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/component_updater/sw_reporter_installer_win.h" 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 11 matching lines...) Expand all
22 #include "base/files/file_util.h" 22 #include "base/files/file_util.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/metrics/histogram_macros.h" 24 #include "base/metrics/histogram_macros.h"
25 #include "base/metrics/sparse_histogram.h" 25 #include "base/metrics/sparse_histogram.h"
26 #include "base/path_service.h" 26 #include "base/path_service.h"
27 #include "base/rand_util.h" 27 #include "base/rand_util.h"
28 #include "base/strings/string_number_conversions.h" 28 #include "base/strings/string_number_conversions.h"
29 #include "base/strings/string_tokenizer.h" 29 #include "base/strings/string_tokenizer.h"
30 #include "base/strings/string_util.h" 30 #include "base/strings/string_util.h"
31 #include "base/strings/utf_string_conversions.h" 31 #include "base/strings/utf_string_conversions.h"
32 #include "base/task_scheduler/post_task.h"
32 #include "base/threading/thread_task_runner_handle.h" 33 #include "base/threading/thread_task_runner_handle.h"
33 #include "base/threading/worker_pool.h"
34 #include "base/time/time.h" 34 #include "base/time/time.h"
35 #include "base/win/registry.h" 35 #include "base/win/registry.h"
36 #include "base/win/windows_version.h" 36 #include "base/win/windows_version.h"
37 #include "chrome/browser/browser_process.h" 37 #include "chrome/browser/browser_process.h"
38 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" 38 #include "chrome/browser/safe_browsing/srt_fetcher_win.h"
39 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" 39 #include "chrome/browser/safe_browsing/srt_field_trial_win.h"
40 #include "components/component_updater/component_updater_paths.h" 40 #include "components/component_updater/component_updater_paths.h"
41 #include "components/component_updater/component_updater_service.h" 41 #include "components/component_updater/component_updater_service.h"
42 #include "components/component_updater/pref_names.h" 42 #include "components/component_updater/pref_names.h"
43 #include "components/pref_registry/pref_registry_syncable.h" 43 #include "components/pref_registry/pref_registry_syncable.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // the current browser startup is complete. (This is the default 129 // the current browser startup is complete. (This is the default
130 // |reporter_runner| function passed to the |SwReporterInstallerTraits| 130 // |reporter_runner| function passed to the |SwReporterInstallerTraits|
131 // constructor in |RegisterSwReporterComponent| below.) 131 // constructor in |RegisterSwReporterComponent| below.)
132 void RunSwReportersAfterStartup( 132 void RunSwReportersAfterStartup(
133 const safe_browsing::SwReporterQueue& invocations, 133 const safe_browsing::SwReporterQueue& invocations,
134 const base::Version& version) { 134 const base::Version& version) {
135 content::BrowserThread::PostAfterStartupTask( 135 content::BrowserThread::PostAfterStartupTask(
136 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), 136 FROM_HERE, base::ThreadTaskRunnerHandle::Get(),
137 base::Bind(&safe_browsing::RunSwReporters, invocations, version, 137 base::Bind(&safe_browsing::RunSwReporters, invocations, version,
138 base::ThreadTaskRunnerHandle::Get(), 138 base::ThreadTaskRunnerHandle::Get(),
139 base::WorkerPool::GetTaskRunner(true))); 139 // Runs LaunchAndWaitForExit() (srt_fetcher_win.cc).
140 base::CreateTaskRunnerWithTraits(
141 base::TaskTraits()
142 .WithShutdownBehavior(
143 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
144 .WithPriority(base::TaskPriority::BACKGROUND)
145 .WithWait())));
140 } 146 }
141 147
142 // Ensures |str| contains only alphanumeric characters and characters from 148 // Ensures |str| contains only alphanumeric characters and characters from
143 // |extras|, and is not longer than |max_length|. 149 // |extras|, and is not longer than |max_length|.
144 bool ValidateString(const std::string& str, 150 bool ValidateString(const std::string& str,
145 const std::string& extras, 151 const std::string& extras,
146 size_t max_length) { 152 size_t max_length) {
147 return str.size() <= max_length && 153 return str.size() <= max_length &&
148 std::all_of(str.cbegin(), str.cend(), [&extras](char c) { 154 std::all_of(str.cbegin(), str.cend(), [&extras](char c) {
149 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || 155 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) ||
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 497 }
492 498
493 void RegisterProfilePrefsForSwReporter( 499 void RegisterProfilePrefsForSwReporter(
494 user_prefs::PrefRegistrySyncable* registry) { 500 user_prefs::PrefRegistrySyncable* registry) {
495 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); 501 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, "");
496 502
497 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); 503 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, "");
498 } 504 }
499 505
500 } // namespace component_updater 506 } // namespace component_updater
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