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

Side by Side Diff: chrome/browser/chromeos/policy/device_status_collector.cc

Issue 2556413002: Remove spam log when querying free/total size. (Closed)
Patch Set: 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) 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/chromeos/policy/device_status_collector.h" 5 #include "chrome/browser/chromeos/policy/device_status_collector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return (out_time - Time::UnixEpoch()).InMilliseconds(); 101 return (out_time - Time::UnixEpoch()).InMilliseconds();
102 } 102 }
103 103
104 // Helper function (invoked via blocking pool) to fetch information about 104 // Helper function (invoked via blocking pool) to fetch information about
105 // mounted disks. 105 // mounted disks.
106 std::vector<em::VolumeInfo> GetVolumeInfo( 106 std::vector<em::VolumeInfo> GetVolumeInfo(
107 const std::vector<std::string>& mount_points) { 107 const std::vector<std::string>& mount_points) {
108 std::vector<em::VolumeInfo> result; 108 std::vector<em::VolumeInfo> result;
109 for (const std::string& mount_point : mount_points) { 109 for (const std::string& mount_point : mount_points) {
110 base::FilePath mount_path(mount_point); 110 base::FilePath mount_path(mount_point);
111
112 // Non-native file systems do not have a mount point in the local file
113 // system. However, it's worth checking here, as it's easier than checking
114 // earlier which mount point is local, and which one is not.
115 if (mount_point.empty() || !base::PathExists(mount_path))
116 continue;
117
111 int64_t free_size = base::SysInfo::AmountOfFreeDiskSpace(mount_path); 118 int64_t free_size = base::SysInfo::AmountOfFreeDiskSpace(mount_path);
112 int64_t total_size = base::SysInfo::AmountOfTotalDiskSpace(mount_path); 119 int64_t total_size = base::SysInfo::AmountOfTotalDiskSpace(mount_path);
113 if (free_size < 0 || total_size < 0) { 120 if (free_size < 0 || total_size < 0) {
114 LOG_IF(ERROR, !mount_point.empty()) << "Unable to get volume status for " 121 LOG(ERROR) << "Unable to get volume status for " << mount_point;
115 << mount_point;
116 continue; 122 continue;
117 } 123 }
118 em::VolumeInfo info; 124 em::VolumeInfo info;
119 info.set_volume_id(mount_point); 125 info.set_volume_id(mount_point);
120 info.set_storage_total(total_size); 126 info.set_storage_total(total_size);
121 info.set_storage_free(free_size); 127 info.set_storage_free(free_size);
122 result.push_back(info); 128 result.push_back(info);
123 } 129 }
124 return result; 130 return result;
125 } 131 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } // namespace 292 } // namespace
287 293
288 namespace policy { 294 namespace policy {
289 295
290 // Helper class for state tracking of async status queries. Creates device and 296 // Helper class for state tracking of async status queries. Creates device and
291 // session status blobs in the constructor and sends them to the the status 297 // session status blobs in the constructor and sends them to the the status
292 // response callback in the destructor. 298 // response callback in the destructor.
293 // 299 //
294 // Some methods like |SampleVolumeInfo| queue async queries to collect data. The 300 // Some methods like |SampleVolumeInfo| queue async queries to collect data. The
295 // response callback of these queries, e.g. |OnVolumeInfoReceived|, holds a 301 // response callback of these queries, e.g. |OnVolumeInfoReceived|, holds a
296 // reference to the instance of this class, so that the destructor will not be 302 // reference to the instance of this class, so that the destru
Andrew T Wilson (Slow) 2016/12/14 16:09:25 undo this change
mtomasz 2016/12/15 05:17:30 Done.
297 // invoked and the status response callback will not be fired until the original 303 // invoked and the status response callback will not be fired until the original
298 // owner of the instance releases its reference and all async queries finish. 304 // owner of the instance releases its reference and all async queries finish.
299 // 305 //
300 // Therefore, if you create an instance of this class, make sure to release your 306 // Therefore, if you create an instance of this class, make sure to release your
301 // reference after quering all async queries (if any), e.g. by using a local 307 // reference after quering all async queries (if any), e.g. by using a local
302 // |scoped_refptr<GetStatusState>| and letting it go out of scope. 308 // |scoped_refptr<GetStatusState>| and letting it go out of scope.
303 class GetStatusState : public base::RefCountedThreadSafe<GetStatusState> { 309 class GetStatusState : public base::RefCountedThreadSafe<GetStatusState> {
304 public: 310 public:
305 explicit GetStatusState( 311 explicit GetStatusState(
306 const scoped_refptr<base::SequencedTaskRunner> task_runner, 312 const scoped_refptr<base::SequencedTaskRunner> task_runner,
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1195
1190 void DeviceStatusCollector::OnOSVersion(const std::string& version) { 1196 void DeviceStatusCollector::OnOSVersion(const std::string& version) {
1191 os_version_ = version; 1197 os_version_ = version;
1192 } 1198 }
1193 1199
1194 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { 1200 void DeviceStatusCollector::OnOSFirmware(const std::string& version) {
1195 firmware_version_ = version; 1201 firmware_version_ = version;
1196 } 1202 }
1197 1203
1198 } // namespace policy 1204 } // namespace policy
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