Commit 25c01e82 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

Fix improper usage of the sequence checker in WMIRefresher

WMIRefresher is created during the creation of SystemMonitor on the UI
thread, it is then used only in a MayBlock sequence.

Change-Id: I7a14f59272a7ac6170c25e15518f31bfbc9f4870
Reviewed-on: https://chromium-review.googlesource.com/c/1493157
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636884}
parent bfd5fd2e
...@@ -72,7 +72,9 @@ enum class WMIRefresher::RefreshStatus { ...@@ -72,7 +72,9 @@ enum class WMIRefresher::RefreshStatus {
}; };
WMIRefresher::WMIRefresher() : initialized_called_(false) { WMIRefresher::WMIRefresher() : initialized_called_(false) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // This object might be created on a sequence different than the one on which
// it'll be used.
DETACH_FROM_SEQUENCE(sequence_checker_);
} }
WMIRefresher::~WMIRefresher() = default; WMIRefresher::~WMIRefresher() = default;
......
...@@ -22,8 +22,11 @@ namespace win { ...@@ -22,8 +22,11 @@ namespace win {
// Wrapper around an IWbemRefresher instance used to retrieve some system // Wrapper around an IWbemRefresher instance used to retrieve some system
// performance counters. // performance counters.
// //
// This object should live on a MayBlock() sequence. Concurrent calls to // The constructor and InitializeDiskIdleTimeConfig() don't have any sequencing
// RefreshAndGetDiskIdleTimeInPercent are not allowed. // requirements. Calls to RefreshAndGetDiskIdleTimeInPercent() must happen on
// the same sequence, after InitializeDiskIdleTimeConfig() has returned. All
// methods except the constructor must be invoked in a context that accepts
// blocking calls (e.g. a MayBlock() sequence).
// //
// This class relies on the fact that by default all sequences are in a // This class relies on the fact that by default all sequences are in a
// multithreaded COM apartment. // multithreaded COM apartment.
...@@ -33,8 +36,7 @@ class WMIRefresher { ...@@ -33,8 +36,7 @@ class WMIRefresher {
~WMIRefresher(); ~WMIRefresher();
// Initialize everything needed to retrieve the disk idle time data via WMI. // Initialize everything needed to retrieve the disk idle time data via WMI.
// This should only be called once. This can be called on a sequence different // This should only be called once.
// than the one on which this object has been created.
// //
// Returns true on success, false otherwise. // Returns true on success, false otherwise.
bool InitializeDiskIdleTimeConfig(); bool InitializeDiskIdleTimeConfig();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment