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

Side by Side Diff: net/quic/crypto/quic_random.cc

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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
« no previous file with comments | « net/quic/crypto/quic_random.h ('k') | net/quic/crypto/quic_random_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "net/quic/crypto/quic_random.h"
6
7 #include "base/logging.h"
8 #include "base/macros.h"
9 #include "base/memory/singleton.h"
10 #include "crypto/random.h"
11 #include "net/quic/quic_bug_tracker.h"
12
13 namespace net {
14
15 namespace {
16
17 class DefaultRandom : public QuicRandom {
18 public:
19 static DefaultRandom* GetInstance();
20
21 // QuicRandom implementation
22 void RandBytes(void* data, size_t len) override;
23 uint64_t RandUint64() override;
24 void Reseed(const void* additional_entropy, size_t entropy_len) override;
25
26 private:
27 DefaultRandom() {}
28 ~DefaultRandom() override {}
29
30 friend struct base::DefaultSingletonTraits<DefaultRandom>;
31 DISALLOW_COPY_AND_ASSIGN(DefaultRandom);
32 };
33
34 DefaultRandom* DefaultRandom::GetInstance() {
35 return base::Singleton<DefaultRandom>::get();
36 }
37
38 void DefaultRandom::RandBytes(void* data, size_t len) {
39 crypto::RandBytes(data, len);
40 }
41
42 uint64_t DefaultRandom::RandUint64() {
43 uint64_t value;
44 RandBytes(&value, sizeof(value));
45 return value;
46 }
47
48 void DefaultRandom::Reseed(const void* additional_entropy, size_t entropy_len) {
49 // No such function exists in crypto/random.h.
50 }
51
52 } // namespace
53
54 // static
55 QuicRandom* QuicRandom::GetInstance() {
56 return DefaultRandom::GetInstance();
57 }
58
59 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_random.h ('k') | net/quic/crypto/quic_random_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698