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

Side by Side Diff: courgette/adjustment_method_2.cc

Issue 6602049: Pure pedantry: Replace all ".size() == 0" with ".empty()". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/adjustment_method.h" 5 #include "courgette/adjustment_method.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 AddPatternToQueues(*p); 981 AddPatternToQueues(*p);
982 } 982 }
983 variable_queue_.ApplyPendingUpdates(); 983 variable_queue_.ApplyPendingUpdates();
984 } 984 }
985 985
986 void RemovePatternFromQueues(const ShinglePattern* pattern) { 986 void RemovePatternFromQueues(const ShinglePattern* pattern) {
987 int single_use_score = SingleUseScore(pattern); 987 int single_use_score = SingleUseScore(pattern);
988 if (single_use_score > 0) { 988 if (single_use_score > 0) {
989 size_t n = single_use_pattern_queue_.erase(pattern); 989 size_t n = single_use_pattern_queue_.erase(pattern);
990 LOG_ASSERT(n == 1); 990 LOG_ASSERT(n == 1);
991 } else if (pattern->program_histogram_.size() == 0 && 991 } else if (pattern->program_histogram_.empty() &&
992 pattern->model_histogram_.size() == 0) { 992 pattern->model_histogram_.empty()) {
993 NOTREACHED(); // Should not come back to life. 993 NOTREACHED(); // Should not come back to life.
994 } else if (pattern->program_histogram_.size() == 0) { 994 } else if (pattern->program_histogram_.empty()) {
995 // Useless pattern. 995 // Useless pattern.
996 } else { 996 } else {
997 active_non_single_use_patterns_.erase(pattern); 997 active_non_single_use_patterns_.erase(pattern);
998 AddPatternToLabelQueue(pattern, -1); 998 AddPatternToLabelQueue(pattern, -1);
999 } 999 }
1000 } 1000 }
1001 1001
1002 void AddPatternToQueues(const ShinglePattern* pattern) { 1002 void AddPatternToQueues(const ShinglePattern* pattern) {
1003 int single_use_score = SingleUseScore(pattern); 1003 int single_use_score = SingleUseScore(pattern);
1004 if (single_use_score > 0) { 1004 if (single_use_score > 0) {
1005 single_use_pattern_queue_.insert(pattern); 1005 single_use_pattern_queue_.insert(pattern);
1006 } else if (pattern->program_histogram_.size() == 0 && 1006 } else if (pattern->program_histogram_.empty() &&
1007 pattern->model_histogram_.size() == 0) { 1007 pattern->model_histogram_.empty()) {
1008 } else if (pattern->program_histogram_.size() == 0) { 1008 } else if (pattern->program_histogram_.empty()) {
1009 // Useless pattern. 1009 // Useless pattern.
1010 } else { 1010 } else {
1011 active_non_single_use_patterns_.insert(pattern); 1011 active_non_single_use_patterns_.insert(pattern);
1012 AddPatternToLabelQueue(pattern, +1); 1012 AddPatternToLabelQueue(pattern, +1);
1013 } 1013 }
1014 } 1014 }
1015 1015
1016 void AddPatternToLabelQueue(const ShinglePattern* pattern, int sign) { 1016 void AddPatternToLabelQueue(const ShinglePattern* pattern, int sign) {
1017 // For each possible assignment in this pattern, update the potential 1017 // For each possible assignment in this pattern, update the potential
1018 // contributions to the LabelInfo queues. 1018 // contributions to the LabelInfo queues.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 1292
1293 //////////////////////////////////////////////////////////////////////////////// 1293 ////////////////////////////////////////////////////////////////////////////////
1294 1294
1295 } // namespace adjustment_method_2 1295 } // namespace adjustment_method_2
1296 1296
1297 AdjustmentMethod* AdjustmentMethod::MakeShingleAdjustmentMethod() { 1297 AdjustmentMethod* AdjustmentMethod::MakeShingleAdjustmentMethod() {
1298 return new adjustment_method_2::Adjuster(); 1298 return new adjustment_method_2::Adjuster();
1299 } 1299 }
1300 1300
1301 } // namespace courgette 1301 } // namespace courgette
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698