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

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

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update location_bar_view_mac.mm Created 8 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 | Annotate | Revision Log
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"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 scoped_ptr<Chunk> chunk(*chunks_.begin()); 103 scoped_ptr<Chunk> chunk(*chunks_.begin());
104 chunks_.weak_erase(chunks_.begin()); 104 chunks_.weak_erase(chunks_.begin());
105 DCHECK_EQ(chunk->header.size(), kHeaderLength); 105 DCHECK_EQ(chunk->header.size(), kHeaderLength);
106 DCHECK_EQ(chunk->content->size(), chunk->ExpectedContentLength()); 106 DCHECK_EQ(chunk->content->size(), chunk->ExpectedContentLength());
107 total_bytes_stored_ -= chunk->content->size(); 107 total_bytes_stored_ -= chunk->content->size();
108 total_bytes_stored_ -= kHeaderLength; 108 total_bytes_stored_ -= kHeaderLength;
109 return chunk->content.Pass(); 109 return chunk->content.Pass();
110 } 110 }
111 111
112 void ChunkedByteBuffer::Clear() { 112 void ChunkedByteBuffer::Clear() {
113 chunks_.reset(); 113 chunks_.clear();
114 partial_chunk_.reset(new Chunk()); 114 partial_chunk_.reset(new Chunk());
115 total_bytes_stored_ = 0; 115 total_bytes_stored_ = 0;
116 } 116 }
117 117
118 ChunkedByteBuffer::Chunk::Chunk() 118 ChunkedByteBuffer::Chunk::Chunk()
119 : content(new std::vector<uint8>()) { 119 : content(new std::vector<uint8>()) {
120 } 120 }
121 121
122 ChunkedByteBuffer::Chunk::~Chunk() { 122 ChunkedByteBuffer::Chunk::~Chunk() {
123 } 123 }
124 124
125 size_t ChunkedByteBuffer::Chunk::ExpectedContentLength() const { 125 size_t ChunkedByteBuffer::Chunk::ExpectedContentLength() const {
126 DCHECK_EQ(header.size(), kHeaderLength); 126 DCHECK_EQ(header.size(), kHeaderLength);
127 return static_cast<size_t>(ReadBigEndian32(&header[0])); 127 return static_cast<size_t>(ReadBigEndian32(&header[0]));
128 } 128 }
129 129
130 } // namespace speech 130 } // namespace speech
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | content/common/gpu/media/h264_dpb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698