diff options
-rw-r--r-- | base/stl_util-inl.h | 16 | ||||
-rw-r--r-- | views/grid_layout.cc | 23 |
2 files changed, 11 insertions, 28 deletions
diff --git a/base/stl_util-inl.h b/base/stl_util-inl.h index 70fa69e..4abc0d2 100644 --- a/base/stl_util-inl.h +++ b/base/stl_util-inl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -57,8 +57,7 @@ template<class T> void STLReserveIfNeeded(T* obj, int new_size) { // advanced, which could result in the hash function trying to deference a // stale pointer. template <class ForwardIterator> -void STLDeleteContainerPointers(ForwardIterator begin, - ForwardIterator end) { +void STLDeleteContainerPointers(ForwardIterator begin, ForwardIterator end) { while (begin != end) { ForwardIterator temp = begin; ++begin; @@ -190,13 +189,10 @@ inline char* string_as_array(std::string* str) { // differed. template <class HashSet> -inline bool -HashSetEquality(const HashSet& set_a, - const HashSet& set_b) { +inline bool HashSetEquality(const HashSet& set_a, const HashSet& set_b) { if (set_a.size() != set_b.size()) return false; for (typename HashSet::const_iterator i = set_a.begin(); - i != set_a.end(); - ++i) { + i != set_a.end(); ++i) { if (set_b.find(*i) == set_b.end()) return false; } @@ -204,9 +200,7 @@ HashSetEquality(const HashSet& set_a, } template <class HashMap> -inline bool -HashMapEquality(const HashMap& map_a, - const HashMap& map_b) { +inline bool HashMapEquality(const HashMap& map_a, const HashMap& map_b) { if (map_a.size() != map_b.size()) return false; for (typename HashMap::const_iterator i = map_a.begin(); i != map_a.end(); ++i) { diff --git a/views/grid_layout.cc b/views/grid_layout.cc index 19021fb..b3f0625 100644 --- a/views/grid_layout.cc +++ b/views/grid_layout.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,6 +7,7 @@ #include <algorithm> #include "base/logging.h" +#include "base/stl_util-inl.h" #include "gfx/insets.h" #include "views/standard_layout.h" #include "views/view.h" @@ -379,10 +380,7 @@ ColumnSet::ColumnSet(int id) : id_(id) { } ColumnSet::~ColumnSet() { - for (std::vector<Column*>::iterator i = columns_.begin(); - i != columns_.end(); ++i) { - delete *i; - } + STLDeleteElements(&columns_); } void ColumnSet::AddPaddingColumn(float resize_percent, int width) { @@ -673,18 +671,9 @@ GridLayout::GridLayout(View* host) } GridLayout::~GridLayout() { - for (std::vector<ColumnSet*>::iterator i = column_sets_.begin(); - i != column_sets_.end(); ++i) { - delete *i; - } - for (std::vector<ViewState*>::iterator i = view_states_.begin(); - i != view_states_.end(); ++i) { - delete *i; - } - for (std::vector<Row*>::iterator i = rows_.begin(); - i != rows_.end(); ++i) { - delete *i; - } + STLDeleteElements(&column_sets_); + STLDeleteElements(&view_states_); + STLDeleteElements(&rows_); } void GridLayout::SetInsets(int top, int left, int bottom, int right) { |