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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/device_event_router.cc

Issue 723923004: Files.app: Add UMA for HardUnplugged events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
Index: chrome/browser/chromeos/extensions/file_manager/device_event_router.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc b/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc
index b6252e351c5844819ec597192efac2cd92e4bea7..f0f207a2c893e89176be9154458221bc68fadf40 100644
--- a/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/metrics/histogram_macros.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h"
#include "chrome/browser/chromeos/file_manager/volume_manager.h"
@@ -80,6 +81,12 @@ void DeviceEventRouter::OnDiskRemoved(
const std::string& device_path = disk.system_path_prefix();
if (!disk.mount_path().empty() &&
GetDeviceState(device_path) != DEVICE_HARD_UNPLUGGED_AND_REPORTED) {
+ // TODO(hirono): Remove the temporary UMA. crbug.com/433734
+ UMA_HISTOGRAM_CUSTOM_TIMES("FileBrowser.HardUnpluggedAfterResume",
+ base::Time::Now() - last_suspend_done_,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(30), 50);
+ last_hard_unpluged_ = base::Time::Now();
OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED,
device_path);
SetDeviceState(device_path, DEVICE_HARD_UNPLUGGED_AND_REPORTED);
@@ -124,11 +131,17 @@ void DeviceEventRouter::OnFormatCompleted(const std::string& device_path,
void DeviceEventRouter::SuspendImminent() {
DCHECK(thread_checker_.CalledOnValidThread());
+ // TODO(hirono): Remove the temporary UMA. crbug.com/433734
+ UMA_HISTOGRAM_CUSTOM_TIMES("FileBrowser.HardUnpluggedBeforeSuspend",
mtomasz 2014/11/17 08:48:03 I think that if there was no unplugging, then we w
hirono 2014/11/25 02:32:13 Done.
+ base::Time::Now() - last_hard_unpluged_,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(30), 50);
is_resuming_ = true;
}
void DeviceEventRouter::SuspendDone(const base::TimeDelta& sleep_duration) {
DCHECK(thread_checker_.CalledOnValidThread());
+ last_suspend_done_ = base::Time::Now();
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&DeviceEventRouter::SuspendDoneDelayed,

Powered by Google App Engine
This is Rietveld 408576698