Commit 87110ad3 authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

Gather metrics on hosted app unlimitedStorage usage

BUG=416691

Review URL: https://codereview.chromium.org/595683002

Cr-Commit-Position: refs/heads/master@{#296298}
parent ba1e1e3f
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/metrics/histogram.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_storage_factory.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
......@@ -91,6 +92,16 @@ ValueStore* LocalValueStoreCache::GetStorage(
new SettingsStorageQuotaEnforcer(
quota_, storage_factory_->Create(file_path, extension->id())));
DCHECK(storage.get());
if (extension->permissions_data()->HasAPIPermission(
APIPermission::kUnlimitedStorage) &&
extension->is_hosted_app()) {
// We're interested in the amount of space hosted apps are using. Record it
// the first time we load the storage for the extension.
UMA_HISTOGRAM_MEMORY_KB("Extensions.HostedAppUnlimitedStorageUsage",
storage->GetBytesInUse());
}
storage_map_[extension->id()] = storage;
return storage.get();
}
......
......@@ -7677,6 +7677,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="Extensions.HostedAppUnlimitedStorageUsage" units="KB">
<owner>rdevlin.cronin@chromium.org</owner>
<summary>
The usage (in kilobytes) of a hosted app with the unlimitedStorage api
permission, recorded once per run per app the first time we load storage for
the hosted app.
</summary>
</histogram>
<histogram name="Extensions.IncognitoAllowed">
<owner>kalman@chromium.org</owner>
<summary>
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