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

Unified Diff: chrome/browser/net/bit_stream_reader.cc

Issue 811353002: Move CT EV white list packaging API from chrome/ to components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed missed nit Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/bit_stream_reader.h ('k') | chrome/browser/net/bit_stream_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/bit_stream_reader.cc
diff --git a/chrome/browser/net/bit_stream_reader.cc b/chrome/browser/net/bit_stream_reader.cc
deleted file mode 100644
index 9e9f0aaf8d2eccc144be12f8eafa04acbf04d7d6..0000000000000000000000000000000000000000
--- a/chrome/browser/net/bit_stream_reader.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/bit_stream_reader.h"
-
-#include "base/big_endian.h"
-#include "base/logging.h"
-#include "base/numerics/safe_conversions.h"
-
-namespace internal {
-
-BitStreamReader::BitStreamReader(const base::StringPiece& source)
- : source_(source), current_byte_(0), current_bit_(7) {
- DCHECK_LT(source_.length(), UINT32_MAX);
-}
-
-bool BitStreamReader::ReadUnaryEncoding(uint64_t* out) {
- if (BitsLeft() == 0)
- return false;
-
- *out = 0;
- while ((BitsLeft() > 0) && ReadBit())
- ++(*out);
-
- return true;
-}
-
-bool BitStreamReader::ReadBits(uint8_t num_bits, uint64_t* out) {
- DCHECK_LE(num_bits, 64);
-
- if (BitsLeft() < num_bits)
- return false;
-
- *out = 0;
- for (uint8_t i = 0; i < num_bits; ++i)
- (*out) |= (static_cast<uint64_t>(ReadBit()) << (num_bits - (i + 1)));
-
- return true;
-}
-
-uint64_t BitStreamReader::BitsLeft() const {
- if (current_byte_ == source_.length())
- return 0;
- DCHECK_GT(source_.length(), current_byte_);
- return (source_.length() - (current_byte_ + 1)) * 8 + current_bit_ + 1;
-}
-
-uint8_t BitStreamReader::ReadBit() {
- DCHECK_GT(BitsLeft(), 0u);
- DCHECK(current_bit_ < 8 && current_bit_ >= 0);
- uint8_t res =
- (source_.data()[current_byte_] & (1 << current_bit_)) >> current_bit_;
- current_bit_--;
- if (current_bit_ < 0) {
- current_byte_++;
- current_bit_ = 7;
- }
-
- return res;
-}
-
-} // namespace internal
« no previous file with comments | « chrome/browser/net/bit_stream_reader.h ('k') | chrome/browser/net/bit_stream_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698