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

Side by Side Diff: sync/internal_api/attachments/on_disk_attachment_store.cc

Issue 751313005: Add the Sync.Attachments.StoreInitResult histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit enum values and increase the SIZE constant to 10. Created 6 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 | « sync/api/attachments/attachment_store.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/internal_api/public/attachments/on_disk_attachment_store.h" 5 #include "sync/internal_api/public/attachments/on_disk_attachment_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/histogram.h"
11 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
12 #include "sync/internal_api/attachments/proto/attachment_store.pb.h" 13 #include "sync/internal_api/attachments/proto/attachment_store.pb.h"
13 #include "sync/internal_api/public/attachments/attachment_util.h" 14 #include "sync/internal_api/public/attachments/attachment_util.h"
14 #include "sync/protocol/attachments.pb.h" 15 #include "sync/protocol/attachments.pb.h"
15 #include "third_party/leveldatabase/src/include/leveldb/db.h" 16 #include "third_party/leveldatabase/src/include/leveldb/db.h"
16 #include "third_party/leveldatabase/src/include/leveldb/options.h" 17 #include "third_party/leveldatabase/src/include/leveldb/options.h"
17 #include "third_party/leveldatabase/src/include/leveldb/slice.h" 18 #include "third_party/leveldatabase/src/include/leveldb/slice.h"
18 #include "third_party/leveldatabase/src/include/leveldb/status.h" 19 #include "third_party/leveldatabase/src/include/leveldb/status.h"
19 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" 20 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
20 21
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const base::FilePath& path) 86 const base::FilePath& path)
86 : callback_task_runner_(callback_task_runner), path_(path) { 87 : callback_task_runner_(callback_task_runner), path_(path) {
87 } 88 }
88 89
89 OnDiskAttachmentStore::~OnDiskAttachmentStore() { 90 OnDiskAttachmentStore::~OnDiskAttachmentStore() {
90 } 91 }
91 92
92 void OnDiskAttachmentStore::Init(const InitCallback& callback) { 93 void OnDiskAttachmentStore::Init(const InitCallback& callback) {
93 DCHECK(CalledOnValidThread()); 94 DCHECK(CalledOnValidThread());
94 Result result_code = OpenOrCreate(path_); 95 Result result_code = OpenOrCreate(path_);
96 UMA_HISTOGRAM_ENUMERATION("Sync.Attachments.StoreInitResult",
97 result_code, RESULT_SIZE);
95 callback_task_runner_->PostTask(FROM_HERE, base::Bind(callback, result_code)); 98 callback_task_runner_->PostTask(FROM_HERE, base::Bind(callback, result_code));
96 } 99 }
97 100
98 void OnDiskAttachmentStore::Read(const AttachmentIdList& ids, 101 void OnDiskAttachmentStore::Read(const AttachmentIdList& ids,
99 const ReadCallback& callback) { 102 const ReadCallback& callback) {
100 DCHECK(CalledOnValidThread()); 103 DCHECK(CalledOnValidThread());
101 scoped_ptr<AttachmentMap> result_map(new AttachmentMap()); 104 scoped_ptr<AttachmentMap> result_map(new AttachmentMap());
102 scoped_ptr<AttachmentIdList> unavailable_attachments(new AttachmentIdList()); 105 scoped_ptr<AttachmentIdList> unavailable_attachments(new AttachmentIdList());
103 106
104 Result result_code = STORE_INITIALIZATION_FAILED; 107 Result result_code = STORE_INITIALIZATION_FAILED;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return key; 394 return key;
392 } 395 }
393 396
394 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata( 397 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata(
395 const AttachmentId& attachment_id, 398 const AttachmentId& attachment_id,
396 const attachment_store_pb::RecordMetadata& record_metadata) { 399 const attachment_store_pb::RecordMetadata& record_metadata) {
397 return AttachmentMetadata(attachment_id, record_metadata.attachment_size()); 400 return AttachmentMetadata(attachment_id, record_metadata.attachment_size());
398 } 401 }
399 402
400 } // namespace syncer 403 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_store.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698