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

Side by Side Diff: courgette/encoded_program.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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
« no previous file with comments | « courgette/adjustment_method.cc ('k') | jingle/notifier/communicator/connection_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "courgette/encoded_program.h" 5 #include "courgette/encoded_program.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 void EncodedProgram::AddCopy(uint32 count, const void* bytes) { 189 void EncodedProgram::AddCopy(uint32 count, const void* bytes) {
190 const uint8* source = static_cast<const uint8*>(bytes); 190 const uint8* source = static_cast<const uint8*>(bytes);
191 191
192 // Fold adjacent COPY instructions into one. This nearly halves the size of 192 // Fold adjacent COPY instructions into one. This nearly halves the size of
193 // an EncodedProgram with only COPY1 instructions since there are approx plain 193 // an EncodedProgram with only COPY1 instructions since there are approx plain
194 // 16 bytes per reloc. This has a working-set benefit during decompression. 194 // 16 bytes per reloc. This has a working-set benefit during decompression.
195 // For compression of files with large differences this makes a small (4%) 195 // For compression of files with large differences this makes a small (4%)
196 // improvement in size. For files with small differences this degrades the 196 // improvement in size. For files with small differences this degrades the
197 // compressed size by 1.3% 197 // compressed size by 1.3%
198 if (ops_.size() > 0) { 198 if (!ops_.empty()) {
199 if (ops_.back() == COPY1) { 199 if (ops_.back() == COPY1) {
200 ops_.back() = COPY; 200 ops_.back() = COPY;
201 copy_counts_.push_back(1); 201 copy_counts_.push_back(1);
202 } 202 }
203 if (ops_.back() == COPY) { 203 if (ops_.back() == COPY) {
204 copy_counts_.back() += count; 204 copy_counts_.back() += count;
205 for (uint32 i = 0; i < count; ++i) { 205 for (uint32 i = 0; i < count; ++i) {
206 copy_bytes_.push_back(source[i]); 206 copy_bytes_.push_back(source[i]);
207 } 207 }
208 return; 208 return;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (assembled) 563 if (assembled)
564 return C_OK; 564 return C_OK;
565 return C_ASSEMBLY_FAILED; 565 return C_ASSEMBLY_FAILED;
566 } 566 }
567 567
568 void DeleteEncodedProgram(EncodedProgram* encoded) { 568 void DeleteEncodedProgram(EncodedProgram* encoded) {
569 delete encoded; 569 delete encoded;
570 } 570 }
571 571
572 } // end namespace 572 } // end namespace
OLDNEW
« no previous file with comments | « courgette/adjustment_method.cc ('k') | jingle/notifier/communicator/connection_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698