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

Unified Diff: chromeos/system/statistics_provider.cc

Issue 2958353002: [Cleanup] Migrate the StatisticsProvider to use the TaskScheduler (Closed)
Patch Set: rewrap a line 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/system/statistics_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/system/statistics_provider.cc
diff --git a/chromeos/system/statistics_provider.cc b/chromeos/system/statistics_provider.cc
index c1ccac21ba834086d6756866714eaeeccf259357..f2f2000c93c8b9e60de201a777cb77a5fa69d3af 100644
--- a/chromeos/system/statistics_provider.cc
+++ b/chromeos/system/statistics_provider.cc
@@ -23,6 +23,8 @@
#include "base/synchronization/waitable_event.h"
#include "base/sys_info.h"
#include "base/task_runner.h"
+#include "base/task_scheduler/post_task.h"
+#include "base/task_scheduler/task_traits.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -208,9 +210,7 @@ bool HasOemPrefix(const std::string& name) {
class StatisticsProviderImpl : public StatisticsProvider {
public:
// StatisticsProvider implementation:
- void StartLoadingMachineStatistics(
- const scoped_refptr<base::TaskRunner>& file_task_runner,
- bool load_oem_manifest) override;
+ void StartLoadingMachineStatistics(bool load_oem_manifest) override;
bool GetMachineStatistic(const std::string& name,
std::string* result) override;
bool GetMachineFlag(const std::string& name, bool* result) override;
@@ -427,7 +427,6 @@ StatisticsProviderImpl::~StatisticsProviderImpl() {
}
void StatisticsProviderImpl::StartLoadingMachineStatistics(
- const scoped_refptr<base::TaskRunner>& file_task_runner,
bool load_oem_manifest) {
CHECK(!load_statistics_started_);
load_statistics_started_ = true;
@@ -435,11 +434,12 @@ void StatisticsProviderImpl::StartLoadingMachineStatistics(
VLOG(1) << "Started loading statistics. Load OEM Manifest: "
<< load_oem_manifest;
- file_task_runner->PostTask(
+ base::PostTaskWithTraits(
FROM_HERE,
- base::Bind(&StatisticsProviderImpl::LoadMachineStatistics,
- base::Unretained(this),
- load_oem_manifest));
+ {base::MayBlock(), base::TaskPriority::BACKGROUND,
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
+ base::BindOnce(&StatisticsProviderImpl::LoadMachineStatistics,
+ base::Unretained(this), load_oem_manifest));
}
void StatisticsProviderImpl::LoadMachineStatistics(bool load_oem_manifest) {
« no previous file with comments | « chromeos/system/statistics_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698