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

Side by Side Diff: components/certificate_transparency/observed_leaf.cc

Issue 2017563002: Add Certificate Transparency logs auditing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing all comments Created 4 years, 5 months 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/certificate_transparency/observed_leaf.h"
6
7 #include "base/time/time.h"
8
9 using net::ct::MerkleTreeLeaf;
10
11 ObservedLeaf::ObservedLeaf(MerkleTreeLeaf&& leaf, const base::Time& observed_at)
12 : leaf_(leaf), observed_at_(observed_at) {}
13
14 ObservedLeaf::ObservedLeaf(const ObservedLeaf& other) = default;
15
16 ObservedLeaf::ObservedLeaf(ObservedLeaf&&) = default;
17
18 ObservedLeaf::~ObservedLeaf() = default;
19
20 void ObservedLeaf::SetLeafIndex(uint64_t index) {
21 // The leaf index may be set only once. Doing so more than once indicates
22 // a programming error where the index is fetched more than once for a given
23 // leaf.
24 CHECK(!leaf_index_);
Ryan Sleevi 2016/06/30 22:48:18 Then programming errors should be met with DCHECK,
Eran Messeri 2016/07/01 13:24:00 Done.
25 leaf_index_ = index;
26 }
27
28 bool ObservedLeaf::HasLeafIndex() const {
29 return bool(leaf_index_);
30 }
31
32 uint64_t ObservedLeaf::GetLeafIndex() const {
33 CHECK(leaf_index_);
34 return leaf_index_.value();
35 }
36
37 const MerkleTreeLeaf& ObservedLeaf::GetLeaf() const {
38 return leaf_;
39 }
40
41 const base::Time& ObservedLeaf::ObservedAt() const {
42 return observed_at_;
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698