summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authormaxbogue <maxbogue@chromium.org>2014-12-11 11:14:02 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-11 19:14:29 +0000
commit771c7499315027a9975160aa8040d6d8e63a7c63 (patch)
treeb957918c7108b2cce9302d1fcbffc7218910dbae /sync
parentccef7796e0fab4bde07c17e00cfdd0ed8f7956a3 (diff)
downloadchromium_src-771c7499315027a9975160aa8040d6d8e63a7c63.zip
chromium_src-771c7499315027a9975160aa8040d6d8e63a7c63.tar.gz
chromium_src-771c7499315027a9975160aa8040d6d8e63a7c63.tar.bz2
Add the Sync.Attachments.StoreInitResult histogram.
BUG=436134 Review URL: https://codereview.chromium.org/751313005 Cr-Commit-Position: refs/heads/master@{#307943}
Diffstat (limited to 'sync')
-rw-r--r--sync/api/attachments/attachment_store.h10
-rw-r--r--sync/internal_api/attachments/on_disk_attachment_store.cc3
2 files changed, 10 insertions, 3 deletions
diff --git a/sync/api/attachments/attachment_store.h b/sync/api/attachments/attachment_store.h
index d6d0d39..b289723 100644
--- a/sync/api/attachments/attachment_store.h
+++ b/sync/api/attachments/attachment_store.h
@@ -33,11 +33,15 @@ class SYNC_EXPORT AttachmentStoreBase {
// TODO(maniscalco): Consider udpating Read and Write methods to support
// resumable transfers (bug 353292).
+ // The result status of an attachment store operation.
+ // Do not re-order or delete these entries; they are used in a UMA histogram.
enum Result {
- SUCCESS, // No error, all completed successfully.
- UNSPECIFIED_ERROR, // An unspecified error occurred for one or more items.
- STORE_INITIALIZATION_FAILED, // AttachmentStore initialization failed.
+ SUCCESS = 0, // No error, all completed successfully.
+ UNSPECIFIED_ERROR = 1, // An unspecified error occurred for >= 1 item.
+ STORE_INITIALIZATION_FAILED = 2, // AttachmentStore initialization failed.
+ // When adding a value here, you must increment RESULT_SIZE below.
};
+ const int RESULT_SIZE = 10; // Size of the Result enum; used for histograms.
typedef base::Callback<void(const Result&)> InitCallback;
typedef base::Callback<void(const Result&,
diff --git a/sync/internal_api/attachments/on_disk_attachment_store.cc b/sync/internal_api/attachments/on_disk_attachment_store.cc
index 309e610..dc51508 100644
--- a/sync/internal_api/attachments/on_disk_attachment_store.cc
+++ b/sync/internal_api/attachments/on_disk_attachment_store.cc
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "sync/internal_api/attachments/proto/attachment_store.pb.h"
#include "sync/internal_api/public/attachments/attachment_util.h"
@@ -92,6 +93,8 @@ OnDiskAttachmentStore::~OnDiskAttachmentStore() {
void OnDiskAttachmentStore::Init(const InitCallback& callback) {
DCHECK(CalledOnValidThread());
Result result_code = OpenOrCreate(path_);
+ UMA_HISTOGRAM_ENUMERATION("Sync.Attachments.StoreInitResult",
+ result_code, RESULT_SIZE);
callback_task_runner_->PostTask(FROM_HERE, base::Bind(callback, result_code));
}