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

Side by Side Diff: content/browser/speech/chunked_byte_buffer.cc

Issue 791923003: replace COMPILE_ASSERT with static_assert in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixups 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "content/browser/speech/chunked_byte_buffer.h" 5 #include "content/browser/speech/chunked_byte_buffer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 namespace { 13 namespace {
14 14
15 static const size_t kHeaderLength = sizeof(uint32); 15 static const size_t kHeaderLength = sizeof(uint32);
16 16
17 COMPILE_ASSERT(sizeof(size_t) >= kHeaderLength, 17 static_assert(sizeof(size_t) >= kHeaderLength,
18 ChunkedByteBufferNotSupportedOnThisArchitecture); 18 "chunked byte buffer not supported on this architecture");
19 19
20 uint32 ReadBigEndian32(const uint8* buffer) { 20 uint32 ReadBigEndian32(const uint8* buffer) {
21 return (static_cast<uint32>(buffer[3])) | 21 return (static_cast<uint32>(buffer[3])) |
22 (static_cast<uint32>(buffer[2]) << 8) | 22 (static_cast<uint32>(buffer[2]) << 8) |
23 (static_cast<uint32>(buffer[1]) << 16) | 23 (static_cast<uint32>(buffer[1]) << 16) |
24 (static_cast<uint32>(buffer[0]) << 24); 24 (static_cast<uint32>(buffer[0]) << 24);
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 ChunkedByteBuffer::Chunk::~Chunk() { 128 ChunkedByteBuffer::Chunk::~Chunk() {
129 } 129 }
130 130
131 size_t ChunkedByteBuffer::Chunk::ExpectedContentLength() const { 131 size_t ChunkedByteBuffer::Chunk::ExpectedContentLength() const {
132 DCHECK_EQ(header.size(), kHeaderLength); 132 DCHECK_EQ(header.size(), kHeaderLength);
133 return static_cast<size_t>(ReadBigEndian32(&header[0])); 133 return static_cast<size_t>(ReadBigEndian32(&header[0]));
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/audio_encoder.cc ('k') | content/browser/speech/endpointer/endpointer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698