diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-10 00:46:16 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-10 00:46:16 +0000 |
commit | 8392ccddddf7f355d57871a5e9af37750f7139f8 (patch) | |
tree | 90fad5b03f607fcabea23fb3756005c50da970cd | |
parent | 5e992fa6227a36da5cb705bfca39ebb785027b61 (diff) | |
download | chromium_src-8392ccddddf7f355d57871a5e9af37750f7139f8.zip chromium_src-8392ccddddf7f355d57871a5e9af37750f7139f8.tar.gz chromium_src-8392ccddddf7f355d57871a5e9af37750f7139f8.tar.bz2 |
Move stack_container and linked_list to the new containers subdirectory.
This also replaces the StackWString with StackString16 and adds a char traits definition to the string16 header file to make this possible without ifdefs.
BUG=
Review URL: https://codereview.chromium.org/11360174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167022 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/base.gyp | 4 | ||||
-rw-r--r-- | base/base.gypi | 4 | ||||
-rw-r--r-- | base/containers/linked_list.h (renamed from base/linked_list.h) | 6 | ||||
-rw-r--r-- | base/containers/linked_list_unittest.cc (renamed from base/linked_list_unittest.cc) | 2 | ||||
-rw-r--r-- | base/containers/stack_container.h (renamed from base/stack_container.h) | 39 | ||||
-rw-r--r-- | base/containers/stack_container_unittest.cc (renamed from base/stack_container_unittest.cc) | 6 | ||||
-rw-r--r-- | base/debug/leak_tracker.h | 2 | ||||
-rw-r--r-- | base/string16.h | 4 | ||||
-rw-r--r-- | chrome/browser/history/history_types.cc | 2 | ||||
-rw-r--r-- | chrome/browser/history/history_types.h | 4 | ||||
-rw-r--r-- | chrome/browser/visitedlink/visitedlink_master.cc | 4 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.h | 4 | ||||
-rw-r--r-- | skia/ext/image_operations.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 6 |
14 files changed, 54 insertions, 39 deletions
diff --git a/base/base.gyp b/base/base.gyp index cc26f48..c1dea4b 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -420,7 +420,9 @@ 'callback_unittest.nc', 'cancelable_callback_unittest.cc', 'command_line_unittest.cc', + 'containers/linked_list_unittest.cc', 'containers/small_map_unittest.cc', + 'containers/stack_container_unittest.cc', 'cpu_unittest.cc', 'debug/leak_tracker_unittest.cc', 'debug/stack_trace_unittest.cc', @@ -455,7 +457,6 @@ 'json/json_writer_unittest.cc', 'json/string_escape_unittest.cc', 'lazy_instance_unittest.cc', - 'linked_list_unittest.cc', 'logging_unittest.cc', 'mac/bind_objc_block_unittest.mm', 'mac/foundation_util_unittest.mm', @@ -506,7 +507,6 @@ 'scoped_temp_dir_unittest.cc', 'sha1_unittest.cc', 'shared_memory_unittest.cc', - 'stack_container_unittest.cc', 'string16_unittest.cc', 'string_number_conversions_unittest.cc', 'string_piece_unittest.cc', diff --git a/base/base.gypi b/base/base.gypi index 8007926..977cc02 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -91,7 +91,9 @@ 'command_line.cc', 'command_line.h', 'compiler_specific.h', + 'containers/linked_list.h', 'containers/small_map.h', + 'containers/stack_container.h', 'cpu.cc', 'cpu.h', 'critical_closure.h', @@ -186,7 +188,6 @@ 'json/string_escape.h', 'lazy_instance.cc', 'lazy_instance.h', - 'linked_list.h', 'location.cc', 'location.h', 'logging.cc', @@ -359,7 +360,6 @@ 'shared_memory_posix.cc', 'shared_memory_win.cc', 'single_thread_task_runner.h', - 'stack_container.h', 'stl_util.h', 'string_number_conversions.cc', 'string_number_conversions.h', diff --git a/base/linked_list.h b/base/containers/linked_list.h index 5b5184f..25bbe76 100644 --- a/base/linked_list.h +++ b/base/containers/linked_list.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_LINKED_LIST_H_ -#define BASE_LINKED_LIST_H_ +#ifndef BASE_CONTAINERS_LINKED_LIST_H_ +#define BASE_CONTAINERS_LINKED_LIST_H_ // Simple LinkedList type. (See the Q&A section to understand how this // differs from std::list). @@ -161,4 +161,4 @@ class LinkedList { } // namespace base -#endif // BASE_LINKED_LIST_H_ +#endif // BASE_CONTAINERS_LINKED_LIST_H_ diff --git a/base/linked_list_unittest.cc b/base/containers/linked_list_unittest.cc index 367564c..801e302 100644 --- a/base/linked_list_unittest.cc +++ b/base/containers/linked_list_unittest.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/linked_list.h" #include "base/basictypes.h" +#include "base/containers/linked_list.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/stack_container.h b/base/containers/stack_container.h index c589783..b3e508b 100644 --- a/base/stack_container.h +++ b/base/containers/stack_container.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_STACK_CONTAINER_H_ -#define BASE_STACK_CONTAINER_H_ +#ifndef BASE_CONTAINERS_STACK_CONTAINER_H_ +#define BASE_CONTAINERS_STACK_CONTAINER_H_ #include <string> #include <vector> @@ -11,6 +11,9 @@ #include "base/basictypes.h" #include "build/build_config.h" #include "base/memory/aligned_memory.h" +#include "base/string16.h" + +namespace base { // This allocator can be used with STL containers to provide a stack buffer // from which to allocate memory and overflows onto the heap. This stack buffer @@ -169,7 +172,8 @@ class StackContainer { DISALLOW_COPY_AND_ASSIGN(StackContainer); }; -// StackString +// StackString ----------------------------------------------------------------- + template<size_t stack_capacity> class StackString : public StackContainer< std::basic_string<char, @@ -188,27 +192,28 @@ class StackString : public StackContainer< DISALLOW_COPY_AND_ASSIGN(StackString); }; -// StackWString +// StackStrin16 ---------------------------------------------------------------- + template<size_t stack_capacity> -class StackWString : public StackContainer< - std::basic_string<wchar_t, - std::char_traits<wchar_t>, - StackAllocator<wchar_t, stack_capacity> >, +class StackString16 : public StackContainer< + std::basic_string<char16, + base::string16_char_traits, + StackAllocator<char16, stack_capacity> >, stack_capacity> { public: - StackWString() : StackContainer< - std::basic_string<wchar_t, - std::char_traits<wchar_t>, - StackAllocator<wchar_t, stack_capacity> >, + StackString16() : StackContainer< + std::basic_string<char16, + base::string16_char_traits, + StackAllocator<char16, stack_capacity> >, stack_capacity>() { } private: - DISALLOW_COPY_AND_ASSIGN(StackWString); + DISALLOW_COPY_AND_ASSIGN(StackString16); }; -// StackVector -// +// StackVector ----------------------------------------------------------------- + // Example: // StackVector<int, 16> foo; // foo->push_back(22); // we have overloaded operator-> @@ -248,4 +253,6 @@ class StackVector : public StackContainer< } }; -#endif // BASE_STACK_CONTAINER_H_ +} // namespace base + +#endif // BASE_CONTAINERS_STACK_CONTAINER_H_ diff --git a/base/stack_container_unittest.cc b/base/containers/stack_container_unittest.cc index 7efab36..3a1b3ed 100644 --- a/base/stack_container_unittest.cc +++ b/base/containers/stack_container_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/stack_container.h" +#include "base/containers/stack_container.h" #include <algorithm> @@ -10,6 +10,8 @@ #include "base/memory/ref_counted.h" #include "testing/gtest/include/gtest/gtest.h" +namespace base { + namespace { class Dummy : public base::RefCounted<Dummy> { @@ -136,3 +138,5 @@ TEST(StackContainer, BufferAlignment) { template class StackVector<int, 2>; template class StackVector<scoped_refptr<Dummy>, 2>; + +} // namespace base diff --git a/base/debug/leak_tracker.h b/base/debug/leak_tracker.h index 22ded0d..93cea39 100644 --- a/base/debug/leak_tracker.h +++ b/base/debug/leak_tracker.h @@ -11,8 +11,8 @@ #endif #ifdef ENABLE_LEAK_TRACKER +#include "base/containers/linked_list.h" #include "base/debug/stack_trace.h" -#include "base/linked_list.h" #include "base/logging.h" #endif // ENABLE_LEAK_TRACKER diff --git a/base/string16.h b/base/string16.h index e27461b..e5d8e35 100644 --- a/base/string16.h +++ b/base/string16.h @@ -37,6 +37,10 @@ typedef wchar_t char16; typedef std::wstring string16; +namespace base { +typedef std::char_traits<wchar_t> string16_char_traits; +} + #elif defined(WCHAR_T_IS_UTF32) typedef uint16 char16; diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index d401873..68a32ba 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -244,7 +244,7 @@ void QueryResults::AddURLUsageAtIndex(const GURL& url, size_t index) { } // Need to add a new entry for this URL. - StackVector<size_t, 4> new_list; + base::StackVector<size_t, 4> new_list; new_list->push_back(index); url_to_results_[url] = new_list; } diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index c97c5b7..9a5d35c 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -12,8 +12,8 @@ #include <vector> #include "base/basictypes.h" +#include "base/containers/stack_container.h" #include "base/memory/ref_counted_memory.h" -#include "base/stack_container.h" #include "base/string16.h" #include "base/time.h" #include "chrome/browser/history/snippet.h" @@ -402,7 +402,7 @@ class QueryResults { // time an entry with that URL appears. Normally, each URL will have one or // very few indices after it, so we optimize this to use statically allocated // memory when possible. - typedef std::map<GURL, StackVector<size_t, 4> > URLToResultIndices; + typedef std::map<GURL, base::StackVector<size_t, 4> > URLToResultIndices; // Inserts an entry into the |url_to_results_| map saying that the given URL // is at the given index in the results_. diff --git a/chrome/browser/visitedlink/visitedlink_master.cc b/chrome/browser/visitedlink/visitedlink_master.cc index 31d5232..ec3c9e6 100644 --- a/chrome/browser/visitedlink/visitedlink_master.cc +++ b/chrome/browser/visitedlink/visitedlink_master.cc @@ -15,13 +15,13 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/containers/stack_container.h" #include "base/file_util.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/rand_util.h" -#include "base/stack_container.h" #include "base/string_util.h" #include "base/threading/thread_restrictions.h" #include "chrome/browser/history/history.h" @@ -458,7 +458,7 @@ bool VisitedLinkMaster::DeleteFingerprint(Fingerprint fingerprint, // instead we just remove them all and re-add them (minus our deleted one). // This will mean there's a small window of time where the affected links // won't be marked visited. - StackVector<Fingerprint, 32> shuffled_fingerprints; + base::StackVector<Fingerprint, 32> shuffled_fingerprints; Hash stop_loop = IncrementHash(end_range); // The end range is inclusive. for (Hash i = deleted_hash; i != stop_loop; i = IncrementHash(i)) { if (hash_table_[i] != fingerprint) { diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index 8d591fc..c8d5ad0 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -11,9 +11,9 @@ #include <string> #include <vector> +#include "base/containers/stack_container.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_handle.h" -#include "base/stack_container.h" #include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/timer.h" @@ -294,7 +294,7 @@ class ProxyFactory { LaunchDelegate* delegate); private: - typedef StackVector<scoped_refptr<AutomationProxyCacheEntry>, 4> Vector; + typedef base::StackVector<scoped_refptr<AutomationProxyCacheEntry>, 4> Vector; Vector proxies_; // Lock if we are going to call GetAutomationServer from more than one thread. base::Lock lock_; diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc index 191f6a9..b048f30 100644 --- a/skia/ext/image_operations.cc +++ b/skia/ext/image_operations.cc @@ -10,10 +10,10 @@ #include "skia/ext/image_operations.h" // TODO(pkasting): skia/ext should not depend on base/! +#include "base/containers/stack_container.h" #include "base/debug/trace_event.h" #include "base/logging.h" #include "base/metrics/histogram.h" -#include "base/stack_container.h" #include "base/time.h" #include "build/build_config.h" #include "skia/ext/convolver.h" @@ -232,8 +232,8 @@ void ResizeFilter::ComputeFilters(int src_size, // Speed up the divisions below by turning them into multiplies. float inv_scale = 1.0f / scale; - StackVector<float, 64> filter_values; - StackVector<int16, 64> fixed_filter_values; + base::StackVector<float, 64> filter_values; + base::StackVector<int16, 64> fixed_filter_values; // Loop over all pixels in the output range. We will generate one set of // filter values for each one. Those values will tell us how to blend the diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index 35cf50b..b2d2c46 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -11,11 +11,11 @@ #include <shlwapi.h> #include "base/command_line.h" +#include "base/containers/stack_container.h" #include "base/debug/trace_event.h" #include "base/file_util.h" #include "base/message_loop.h" #include "base/path_service.h" -#include "base/stack_container.h" #include "base/string_piece.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -99,13 +99,13 @@ bool MinidumpCallback(const wchar_t *dumpPath, // StackString uses the stack but overflows onto the heap. But we don't // care too much about being completely correct here, since most crashes // will be happening on developers' machines where they have debuggers. - StackWString<kPathBufSize * 2> origPath; + base::StackString16<kPathBufSize * 2> origPath; origPath->append(dumpPath); origPath->push_back(FilePath::kSeparators[0]); origPath->append(minidumpID); origPath->append(L".dmp"); - StackWString<kPathBufSize * 2> newPath; + base::StackString16<kPathBufSize * 2> newPath; newPath->append(dumpPath); newPath->push_back(FilePath::kSeparators[0]); newPath->append(g_currentTestName); |