diff options
Diffstat (limited to 'chrome')
64 files changed, 80 insertions, 590 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index 3bf43dd..f0eb9b8 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -5,6 +5,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "base/gfx/png_decoder.h" +#include "base/scoped_vector.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/bookmarks/bookmark_storage.h" @@ -12,7 +13,6 @@ #include "chrome/browser/profile.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/scoped_vector.h" #include "grit/generated_resources.h" using base::Time; diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc index 7837380..09e71b8 100644 --- a/chrome/browser/cert_store.cc +++ b/chrome/browser/cert_store.cc @@ -7,11 +7,11 @@ #include <algorithm> #include <functional> +#include "base/stl_util-inl.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" template <typename T> struct MatchSecond { diff --git a/chrome/browser/command_updater.cc b/chrome/browser/command_updater.cc index db34bbd..c63c6a0 100644 --- a/chrome/browser/command_updater.cc +++ b/chrome/browser/command_updater.cc @@ -7,7 +7,7 @@ #include "chrome/browser/command_updater.h" #include "base/logging.h" -#include "chrome/common/stl_util-inl.h" +#include "base/stl_util-inl.h" CommandUpdater::CommandUpdater(CommandUpdaterDelegate* handler) : delegate_(handler) { diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc index 54325b4..17a1d64 100644 --- a/chrome/browser/dom_ui/dom_ui.cc +++ b/chrome/browser/dom_ui/dom_ui.cc @@ -6,11 +6,11 @@ #include "base/json_reader.h" #include "base/json_writer.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/stl_util-inl.h" DOMUI::DOMUI(TabContents* contents) : hide_favicon_(false), diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index a44e5fe..6a93398 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -6,6 +6,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/task.h" #include "build/build_config.h" @@ -17,7 +18,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" -#include "chrome/common/stl_util-inl.h" #include "googleurl/src/gurl.h" #include "net/base/io_buffer.h" #include "net/base/net_util.h" diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 5e87d0e..9bf96a5 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -10,6 +10,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/rand_util.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/task.h" @@ -33,7 +34,6 @@ #include "chrome/common/platform_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc index 133cdbe..48a3797 100644 --- a/chrome/browser/download/save_file_manager.cc +++ b/chrome/browser/download/save_file_manager.cc @@ -8,6 +8,7 @@ #include "base/file_util.h" #include "base/logging.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/task.h" #include "chrome/browser/browser_process.h" @@ -18,7 +19,6 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" -#include "chrome/common/stl_util-inl.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "net/base/io_buffer.h" diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 57ed679..920fe1d 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/task.h" #include "base/thread.h" @@ -29,7 +30,6 @@ #include "chrome/common/platform_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "net/base/io_buffer.h" diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index 4a96c12..8c8a3b9 100755 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -6,6 +6,7 @@ #include "base/json_writer.h" #include "base/singleton.h" +#include "base/stl_util-inl.h" #include "base/values.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/extensions/extension.h" @@ -18,7 +19,6 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/stl_util-inl.h" // Since we have 2 ports for every channel, we just index channels by half the // port ID. @@ -215,7 +215,7 @@ void ExtensionMessageService::Observe(NotificationType type, DCHECK(type.value == NotificationType::RENDERER_PROCESS_TERMINATED || type.value == NotificationType::RENDERER_PROCESS_CLOSED); - + RenderProcessHost* renderer = Source<RenderProcessHost>(source).ptr(); { diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 85d3a6a..bcacf671f 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -10,9 +10,9 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/pickle.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/url_constants.h" #include "net/base/net_util.h" diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index d8af551..1e08bab 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -11,6 +11,7 @@ #include "base/file_path.h" #include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/scoped_vector.h" #include "base/task.h" #include "chrome/browser/history/archived_database.h" #include "chrome/browser/history/download_types.h" @@ -23,7 +24,6 @@ #include "chrome/browser/history/thumbnail_database.h" #include "chrome/browser/history/visit_tracker.h" #include "chrome/common/mru_cache.h" -#include "chrome/common/scoped_vector.h" #include "testing/gtest/include/gtest/gtest_prod.h" class BookmarkService; diff --git a/chrome/browser/history/history_marshaling.h b/chrome/browser/history/history_marshaling.h index 86719b5..bf558c8 100644 --- a/chrome/browser/history/history_marshaling.h +++ b/chrome/browser/history/history_marshaling.h @@ -8,10 +8,10 @@ #ifndef CHROME_BROWSER_HISTORY_HISTORY_MARSHALING_H__ #define CHROME_BROWSER_HISTORY_HISTORY_MARSHALING_H__ +#include "base/scoped_vector.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/page_usage_data.h" -#include "chrome/common/scoped_vector.h" namespace history { diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index 62d737d..7a973ba 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -13,10 +13,10 @@ #include "base/basictypes.h" #include "base/gfx/rect.h" #include "base/stack_container.h" +#include "base/stl_util-inl.h" #include "base/time.h" #include "chrome/browser/history/snippet.h" #include "chrome/common/page_transition_types.h" -#include "chrome/common/stl_util-inl.h" #include "googleurl/src/gurl.h" namespace history { diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index ed5e4e9..2474e6c 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -26,6 +26,7 @@ #include "base/gfx/jpeg_codec.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/scoped_vector.h" #include "base/string_util.h" #include "base/task.h" #include "chrome/browser/browser_process.h" @@ -39,7 +40,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/notification_service.h" #include "chrome/common/sqlite_utils.h" -#include "chrome/common/scoped_vector.h" #include "chrome/common/thumbnail_score.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/history/query_parser.cc b/chrome/browser/history/query_parser.cc index 3f80f7f..8c3a2f3 100644 --- a/chrome/browser/history/query_parser.cc +++ b/chrome/browser/history/query_parser.cc @@ -7,10 +7,10 @@ #include "chrome/browser/history/query_parser.h" #include "base/logging.h" +#include "base/scoped_vector.h" #include "base/string_util.h" #include "base/word_iterator.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/scoped_vector.h" #include "unicode/uscript.h" namespace { diff --git a/chrome/browser/history/query_parser_unittest.cc b/chrome/browser/history/query_parser_unittest.cc index 5a97fec..9245cc9 100644 --- a/chrome/browser/history/query_parser_unittest.cc +++ b/chrome/browser/history/query_parser_unittest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/history/query_parser.h" #include "base/basictypes.h" -#include "chrome/common/scoped_vector.h" +#include "base/scoped_vector.h" +#include "chrome/browser/history/query_parser.h" #include "testing/gtest/include/gtest/gtest.h" class QueryParserTest : public testing::Test { diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc index a2b1321c..b56bcd9 100644 --- a/chrome/browser/history/starred_url_database.cc +++ b/chrome/browser/history/starred_url_database.cc @@ -7,6 +7,8 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/json_writer.h" +#include "base/scoped_vector.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_codec.h" @@ -14,10 +16,8 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/history/query_parser.h" #include "chrome/browser/meta_table_helper.h" -#include "chrome/common/scoped_vector.h" #include "chrome/common/sqlite_compiled_statement.h" #include "chrome/common/sqlite_utils.h" -#include "chrome/common/stl_util-inl.h" using base::Time; diff --git a/chrome/browser/icon_manager.cc b/chrome/browser/icon_manager.cc index 0513a81..4b0c21b 100644 --- a/chrome/browser/icon_manager.cc +++ b/chrome/browser/icon_manager.cc @@ -6,7 +6,7 @@ #include "base/file_util.h" #include "base/scoped_ptr.h" -#include "chrome/common/stl_util-inl.h" +#include "base/stl_util-inl.h" #include "SkBitmap.h" #include "SkCanvas.h" diff --git a/chrome/browser/navigation_controller_unittest.cc b/chrome/browser/navigation_controller_unittest.cc index 3b25a56..38c539a 100644 --- a/chrome/browser/navigation_controller_unittest.cc +++ b/chrome/browser/navigation_controller_unittest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/history/history.h" @@ -18,7 +19,6 @@ #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/test/test_notification_tracker.h" #include "chrome/test/testing_profile.h" #include "net/base/net_util.h" diff --git a/chrome/browser/password_manager/password_form_manager.h b/chrome/browser/password_manager/password_form_manager.h index 7ae079f..332eea3 100644 --- a/chrome/browser/password_manager/password_form_manager.h +++ b/chrome/browser/password_manager/password_form_manager.h @@ -6,7 +6,8 @@ #define CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__ #include "build/build_config.h" -#include "chrome/common/stl_util-inl.h" + +#include "base/stl_util-inl.h" #include "chrome/browser/webdata/web_data_service.h" #include "webkit/glue/password_form.h" diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 265e2de..2d0e7f0 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -5,6 +5,7 @@ #include "chrome/browser/password_manager/password_manager.h" #include "app/resource_bundle.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -13,7 +14,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index cfe5443..9c80714 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_PASSWORD_MANAGER_H__ #include "base/scoped_ptr.h" +#include "base/stl_util-inl.h" #include "chrome/browser/password_manager/password_form_manager.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/views/login_view.h" #include "chrome/common/pref_member.h" -#include "chrome/common/stl_util-inl.h" #include "webkit/glue/password_form.h" #include "webkit/glue/password_form_dom_manager.h" diff --git a/chrome/browser/printing/page_range.cc b/chrome/browser/printing/page_range.cc index e46cd3a..bb9d05a 100644 --- a/chrome/browser/printing/page_range.cc +++ b/chrome/browser/printing/page_range.cc @@ -4,7 +4,7 @@ #include "chrome/browser/printing/page_range.h" -#include "chrome/common/stl_util-inl.h" +#include "base/stl_util-inl.h" namespace printing { diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index d78e79a..3f0075b 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -10,6 +10,7 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/stl_util-inl.h" #include "base/time.h" #include "chrome/browser/cert_store.h" #include "chrome/browser/cross_site_request_manager.h" @@ -35,7 +36,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" -#include "chrome/common/stl_util-inl.h" #include "net/base/auth.h" #include "net/base/cert_status_flags.h" #include "net/base/load_flags.h" diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 9f3ca7e..9740161 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/rand_util.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/sys_info.h" #include "base/task.h" @@ -17,7 +18,6 @@ #include "chrome/browser/safe_browsing/protocol_parser.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/common/env_vars.h" -#include "chrome/common/stl_util-inl.h" #include "net/base/base64.h" #include "net/base/escape.h" #include "net/base/load_flags.h" diff --git a/chrome/browser/search_engines/template_url_fetcher.h b/chrome/browser/search_engines/template_url_fetcher.h index f69be2d..27703ec 100644 --- a/chrome/browser/search_engines/template_url_fetcher.h +++ b/chrome/browser/search_engines/template_url_fetcher.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_TEMPLATE_URL_FETCHER_H_ #include "base/gfx/native_widget_types.h" -#include "chrome/common/scoped_vector.h" +#include "base/scoped_vector.h" class GURL; class Profile; diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index 9399a95..10f9137 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -7,6 +7,7 @@ #include <algorithm> #include "base/logging.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/google_url_tracker.h" @@ -20,7 +21,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_parse.h" diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index 322c1a6..17ae118 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/scoped_vector.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/common/pref_names.h" -#include "chrome/common/scoped_vector.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc index 694742f..832a26e 100644 --- a/chrome/browser/sessions/base_session_service.cc +++ b/chrome/browser/sessions/base_session_service.cc @@ -5,13 +5,13 @@ #include "chrome/browser/sessions/base_session_service.h" #include "base/pickle.h" +#include "base/stl_util-inl.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" #include "chrome/browser/sessions/session_backend.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/common/stl_util-inl.h" #include "webkit/glue/webkit_glue.h" // InternalGetCommandsRequest ------------------------------------------------- diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index ea14c17..6658673 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -8,7 +8,7 @@ #include "base/file_util.h" #include "base/histogram.h" -#include "chrome/common/scoped_vector.h" +#include "base/scoped_vector.h" using base::TimeTicks; diff --git a/chrome/browser/sessions/session_backend_unittest.cc b/chrome/browser/sessions/session_backend_unittest.cc index e5ba17d4..3dc15ce 100644 --- a/chrome/browser/sessions/session_backend_unittest.cc +++ b/chrome/browser/sessions/session_backend_unittest.cc @@ -4,11 +4,11 @@ #include "base/file_path.h" #include "base/file_util.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/path_service.h" #include "base/time.h" #include "chrome/browser/sessions/session_backend.h" -#include "chrome/common/stl_util-inl.h" #include "testing/gtest/include/gtest/gtest.h" namespace { diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 9e13654..786e56c 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/pickle.h" +#include "base/scoped_vector.h" #include "base/thread.h" #include "chrome/browser/browser_init.h" #include "chrome/browser/browser_list.h" @@ -26,7 +27,6 @@ #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_service.h" -#include "chrome/common/scoped_vector.h" using base::Time; diff --git a/chrome/browser/sessions/session_service_test_helper.cc b/chrome/browser/sessions/session_service_test_helper.cc index 0fdc03b..871c222 100644 --- a/chrome/browser/sessions/session_service_test_helper.cc +++ b/chrome/browser/sessions/session_service_test_helper.cc @@ -4,11 +4,11 @@ #include "chrome/browser/sessions/session_service_test_helper.h" +#include "base/scoped_vector.h" #include "chrome/browser/sessions/session_backend.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_types.h" -#include "chrome/common/scoped_vector.h" #include "testing/gtest/include/gtest/gtest.h" using base::Time; diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index 82558c3..ba990bb 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -4,6 +4,8 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/scoped_vector.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/browser/sessions/session_backend.h" @@ -12,8 +14,6 @@ #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/scoped_vector.h" -#include "chrome/common/stl_util-inl.h" #include "testing/gtest/include/gtest/gtest.h" class SessionServiceTest : public testing::Test { diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h index 986381f..31cde3b 100644 --- a/chrome/browser/sessions/session_types.h +++ b/chrome/browser/sessions/session_types.h @@ -9,11 +9,11 @@ #include <vector> #include "base/gfx/rect.h" +#include "base/stl_util-inl.h" #include "base/string16.h" #include "chrome/browser/browser.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/common/page_transition_types.h" -#include "chrome/common/stl_util-inl.h" #include "googleurl/src/gurl.h" class NavigationEntry; diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 6327993..5399c21 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/sessions/tab_restore_service.h" + #include <algorithm> #include <iterator> -#include "chrome/browser/sessions/tab_restore_service.h" - +#include "base/scoped_vector.h" +#include "base/stl_util-inl.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/profile.h" #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_command.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/common/scoped_vector.h" -#include "chrome/common/stl_util-inl.h" using base::Time; diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 038f01c..dd06cc1 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" @@ -14,7 +15,6 @@ #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/url_constants.h" namespace { diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index dc54096..0c77cba 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "chrome/browser/dock_info.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/profile.h" @@ -15,7 +16,6 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/tabs/tab_strip_model_order_controller.h" #include "chrome/common/pref_names.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/url_constants.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc index 39d4ccb..2d29f8f 100644 --- a/chrome/browser/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager_resource_providers.cc @@ -9,6 +9,7 @@ #include "base/file_version_info.h" #include "base/message_loop.h" #include "base/process_util.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser_process.h" @@ -20,7 +21,6 @@ #include "chrome/common/child_process_host.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" #if defined(OS_WIN) #include "chrome/common/gfx/icon_util.h" #endif // defined(OS_WIN) diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index e707cb9..7ea7771 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -8,6 +8,7 @@ #include "app/resource_bundle.h" #include "base/gfx/png_decoder.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/history/history.h" #include "chrome/browser/profile.h" @@ -19,7 +20,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/views/background.h" #include "chrome/views/grid_layout.h" #include "chrome/views/controls/button/native_button.h" diff --git a/chrome/browser/views/options/passwords_page_view.h b/chrome/browser/views/options/passwords_page_view.h index dca2b1e..b585159 100644 --- a/chrome/browser/views/options/passwords_page_view.h +++ b/chrome/browser/views/options/passwords_page_view.h @@ -8,10 +8,10 @@ #include <vector> #include "base/scoped_ptr.h" +#include "base/stl_util-inl.h" #include "chrome/browser/views/options/options_page_view.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/gfx/text_elider.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/table/table_view.h" diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index a19d6c7..720e255 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -6,6 +6,7 @@ #include "app/resource_bundle.h" #include "base/gfx/png_decoder.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/profile.h" @@ -15,7 +16,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/views/background.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/text_field.h" diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 1218ed8..0543628 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -6,6 +6,7 @@ #include "app/resource_bundle.h" #include "base/gfx/size.h" +#include "base/stl_util-inl.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -21,7 +22,6 @@ #include "chrome/common/os_exchange_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/slide_animation.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/win_util.h" #include "chrome/views/controls/image_view.h" #include "chrome/views/painter.h" diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 08c0dbe..4c38e1b 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -11,9 +11,9 @@ #include "base/lock.h" #include "base/message_loop.h" #include "base/ref_counted.h" +#include "base/scoped_vector.h" #include "base/thread.h" #include "chrome/browser/webdata/web_database.h" -#include "chrome/common/scoped_vector.h" #include "webkit/glue/autofill_form.h" #if defined(OS_WIN) diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 09e5be4..2a7b5f9 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -4,13 +4,13 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" #include "base/values.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/stl_util-inl.h" #include "skia/include/SkBitmap.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/autofill_form.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 788d445..45d4b77 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -373,7 +373,6 @@ 'common/result_codes.h', 'common/sandbox_init_wrapper.cc', 'common/sandbox_init_wrapper.h', - 'common/scoped_vector.h', 'common/security_filter_peer.cc', 'common/security_filter_peer.h', 'common/slide_animation.cc', @@ -382,7 +381,6 @@ 'common/sqlite_compiled_statement.h', 'common/sqlite_utils.cc', 'common/sqlite_utils.h', - 'common/stl_util-inl.h', 'common/task_queue.cc', 'common/task_queue.h', 'common/temp_scaffolding_stubs.cc', diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index be7638f..68c0b25 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -750,10 +750,6 @@ > </File> <File - RelativePath=".\scoped_vector.h" - > - </File> - <File RelativePath=".\security_filter_peer.cc" > </File> @@ -786,10 +782,6 @@ > </File> <File - RelativePath=".\stl_util-inl.h" - > - </File> - <File RelativePath=".\task_queue.cc" > </File> diff --git a/chrome/common/ipc_sync_channel_unittest.cc b/chrome/common/ipc_sync_channel_unittest.cc index 6e00fca..218bdd5 100644 --- a/chrome/common/ipc_sync_channel_unittest.cc +++ b/chrome/common/ipc_sync_channel_unittest.cc @@ -11,12 +11,12 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/platform_thread.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/thread.h" #include "base/waitable_event.h" #include "chrome/common/ipc_message.h" #include "chrome/common/ipc_sync_channel.h" -#include "chrome/common/stl_util-inl.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/common/l10n_util_unittest.cc b/chrome/common/l10n_util_unittest.cc index 668e88c..5fbff86 100644 --- a/chrome/common/l10n_util_unittest.cc +++ b/chrome/common/l10n_util_unittest.cc @@ -7,13 +7,13 @@ #include "base/basictypes.h" #include "base/file_util.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #if defined(OS_WIN) #include "base/win_util.h" #endif #include "chrome/common/chrome_paths.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/stl_util-inl.h" #if !defined(OS_MACOSX) #include "chrome/test/data/resource.h" #endif diff --git a/chrome/common/os_exchange_data.cc b/chrome/common/os_exchange_data.cc index fbedcb8..114c480 100644 --- a/chrome/common/os_exchange_data.cc +++ b/chrome/common/os_exchange_data.cc @@ -11,9 +11,9 @@ #include "base/logging.h" #include "base/pickle.h" #include "base/scoped_handle.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/win_util.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" diff --git a/chrome/common/pref_service.cc b/chrome/common/pref_service.cc index 74d8805..7ea11ee 100644 --- a/chrome/common/pref_service.cc +++ b/chrome/common/pref_service.cc @@ -6,12 +6,12 @@ #include "base/logging.h" #include "base/message_loop.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/thread.h" #include "chrome/common/json_value_serializer.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" #include "grit/generated_resources.h" namespace { diff --git a/chrome/common/scoped_vector.h b/chrome/common/scoped_vector.h deleted file mode 100644 index d7da770..0000000 --- a/chrome/common/scoped_vector.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#ifndef CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ -#define CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ - -#include <vector> - -#include "chrome/common/stl_util-inl.h" - -// ScopedVector wraps a vector deleting the elements from its -// destructor. -template <class T> -class ScopedVector { - public: - typedef typename std::vector<T*>::iterator iterator; - typedef typename std::vector<T*>::const_iterator const_iterator; - - ScopedVector() {} - ~ScopedVector() { reset(); } - - std::vector<T*>* operator->() { return &v; } - const std::vector<T*>* operator->() const { return &v; } - T* operator[](size_t i) { return v[i]; } - const T* operator[](size_t i) const { return v[i]; } - - bool empty() const { return v.empty(); } - size_t size() const { return v.size(); } - - iterator begin() { return v.begin(); } - const_iterator begin() const { return v.begin(); } - iterator end() { return v.end(); } - const_iterator end() const { return v.end(); } - - void push_back(T* elem) { v.push_back(elem); } - - std::vector<T*>& get() { return v; } - const std::vector<T*>& get() const { return v; } - void swap(ScopedVector<T>& other) { v.swap(other.v); } - void release(std::vector<T*>* out) { out->swap(v); v.clear(); } - - void reset() { STLDeleteElements(&v); } - - private: - std::vector<T*> v; - - DISALLOW_EVIL_CONSTRUCTORS(ScopedVector); -}; - -#endif // CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ diff --git a/chrome/common/sqlite_compiled_statement.cc b/chrome/common/sqlite_compiled_statement.cc index 5e90b08..cdcb8a3 100644 --- a/chrome/common/sqlite_compiled_statement.cc +++ b/chrome/common/sqlite_compiled_statement.cc @@ -5,7 +5,7 @@ #include "chrome/common/sqlite_compiled_statement.h" #include "base/logging.h" -#include "chrome/common/stl_util-inl.h" +#include "base/stl_util-inl.h" // SqliteStatementCache ------------------------------------------------------- diff --git a/chrome/common/stl_util-inl.h b/chrome/common/stl_util-inl.h deleted file mode 100644 index f13de2b..0000000 --- a/chrome/common/stl_util-inl.h +++ /dev/null @@ -1,452 +0,0 @@ -// -// Copyright (c) 2006-2008 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. -// -// STL utility functions. Usually, these replace built-in, but slow(!), -// STL functions with more efficient versions. -// - -#ifndef CHROME_COMMON_STL_UTIL_INL_H__ -#define CHROME_COMMON_STL_UTIL_INL_H__ - -#include <string.h> // for memcpy -#include <functional> -#include <set> -#include <string> -#include <vector> -#include <cassert> - -// Clear internal memory of an STL object. -// STL clear()/reserve(0) does not always free internal memory allocated -// This function uses swap/destructor to ensure the internal memory is freed. -template<class T> void STLClearObject(T* obj) { - T tmp; - tmp.swap(*obj); - obj->reserve(0); // this is because sometimes "T tmp" allocates objects with - // memory (arena implementation?). use reserve() - // to clear() even if it doesn't always work -} - -// Reduce memory usage on behalf of object if it is using more than -// "bytes" bytes of space. By default, we clear objects over 1MB. -template <class T> inline void STLClearIfBig(T* obj, size_t limit = 1<<20) { - if (obj->capacity() >= limit) { - STLClearObject(obj); - } else { - obj->clear(); - } -} - -// Reserve space for STL object. -// STL's reserve() will always copy. -// This function avoid the copy if we already have capacity -template<class T> void STLReserveIfNeeded(T* obj, int new_size) { - if (obj->capacity() < new_size) // increase capacity - obj->reserve(new_size); - else if (obj->size() > new_size) // reduce size - obj->resize(new_size); -} - -// STLDeleteContainerPointers() -// For a range within a container of pointers, calls delete -// (non-array version) on these pointers. -// NOTE: for these three functions, we could just implement a DeleteObject -// functor and then call for_each() on the range and functor, but this -// requires us to pull in all of algorithm.h, which seems expensive. -// For hash_[multi]set, it is important that this deletes behind the iterator -// because the hash_set may call the hash function on the iterator when it is -// advanced, which could result in the hash function trying to deference a -// stale pointer. -template <class ForwardIterator> -void STLDeleteContainerPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete *temp; - } -} - -// STLDeleteContainerPairPointers() -// For a range within a container of pairs, calls delete -// (non-array version) on BOTH items in the pairs. -// NOTE: Like STLDeleteContainerPointers, it is important that this deletes -// behind the iterator because if both the key and value are deleted, the -// container may call the hash function on the iterator when it is advanced, -// which could result in the hash function trying to dereference a stale -// pointer. -template <class ForwardIterator> -void STLDeleteContainerPairPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete temp->first; - delete temp->second; - } -} - -// STLDeleteContainerPairFirstPointers() -// For a range within a container of pairs, calls delete (non-array version) -// on the FIRST item in the pairs. -// NOTE: Like STLDeleteContainerPointers, deleting behind the iterator. -template <class ForwardIterator> -void STLDeleteContainerPairFirstPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - ForwardIterator temp = begin; - ++begin; - delete temp->first; - } -} - -// STLDeleteContainerPairSecondPointers() -// For a range within a container of pairs, calls delete -// (non-array version) on the SECOND item in the pairs. -template <class ForwardIterator> -void STLDeleteContainerPairSecondPointers(ForwardIterator begin, - ForwardIterator end) { - while (begin != end) { - delete begin->second; - ++begin; - } -} - -template<typename T> -inline void STLAssignToVector(std::vector<T>* vec, - const T* ptr, - size_t n) { - vec->resize(n); - memcpy(&vec->front(), ptr, n*sizeof(T)); -} - -/***** Hack to allow faster assignment to a vector *****/ - -// This routine speeds up an assignment of 32 bytes to a vector from -// about 250 cycles per assignment to about 140 cycles. -// -// Usage: -// STLAssignToVectorChar(&vec, ptr, size); -// STLAssignToString(&str, ptr, size); - -inline void STLAssignToVectorChar(std::vector<char>* vec, - const char* ptr, - size_t n) { - STLAssignToVector(vec, ptr, n); -} - -inline void STLAssignToString(std::string* str, const char* ptr, size_t n) { - str->resize(n); - memcpy(&*str->begin(), ptr, n); -} - -// To treat a possibly-empty vector as an array, use these functions. -// If you know the array will never be empty, you can use &*v.begin() -// directly, but that is allowed to dump core if v is empty. This -// function is the most efficient code that will work, taking into -// account how our STL is actually implemented. THIS IS NON-PORTABLE -// CODE, so call us instead of repeating the nonportable code -// everywhere. If our STL implementation changes, we will need to -// change this as well. - -template<typename T> -inline T* vector_as_array(std::vector<T>* v) { -# ifdef NDEBUG - return &*v->begin(); -# else - return v->empty() ? NULL : &*v->begin(); -# endif -} - -template<typename T> -inline const T* vector_as_array(const std::vector<T>* v) { -# ifdef NDEBUG - return &*v->begin(); -# else - return v->empty() ? NULL : &*v->begin(); -# endif -} - -// Return a mutable char* pointing to a string's internal buffer, -// which may not be null-terminated. Writing through this pointer will -// modify the string. -// -// string_as_array(&str)[i] is valid for 0 <= i < str.size() until the -// next call to a string method that invalidates iterators. -// -// As of 2006-04, there is no standard-blessed way of getting a -// mutable reference to a string's internal buffer. However, issue 530 -// (http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#530) -// proposes this as the method. According to Matt Austern, this should -// already work on all current implementations. -inline char* string_as_array(std::string* str) { - // DO NOT USE const_cast<char*>(str->data())! See the unittest for why. - return str->empty() ? NULL : &*str->begin(); -} - -// These are methods that test two hash maps/sets for equality. These exist -// because the == operator in the STL can return false when the maps/sets -// contain identical elements. This is because it compares the internal hash -// tables which may be different if the order of insertions and deletions -// differed. - -template <class HashSet> -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) { - if (set_b.find(*i) == set_b.end()) - return false; - } - return true; -} - -template <class HashMap> -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) { - typename HashMap::const_iterator j = map_b.find(i->first); - if (j == map_b.end()) return false; - if (i->second != j->second) return false; - } - return true; -} - -// The following functions are useful for cleaning up STL containers -// whose elements point to allocated memory. - -// STLDeleteElements() deletes all the elements in an STL container and clears -// the container. This function is suitable for use with a vector, set, -// hash_set, or any other STL container which defines sensible begin(), end(), -// and clear() methods. -// -// If container is NULL, this function is a no-op. -// -// As an alternative to calling STLDeleteElements() directly, consider -// STLElementDeleter (defined below), which ensures that your container's -// elements are deleted when the STLElementDeleter goes out of scope. -template <class T> -void STLDeleteElements(T *container) { - if (!container) return; - STLDeleteContainerPointers(container->begin(), container->end()); - container->clear(); -} - -// Given an STL container consisting of (key, value) pairs, STLDeleteValues -// deletes all the "value" components and clears the container. Does nothing -// in the case it's given a NULL pointer. - -template <class T> -void STLDeleteValues(T *v) { - if (!v) return; - for (typename T::iterator i = v->begin(); i != v->end(); ++i) { - delete i->second; - } - v->clear(); -} - - -// The following classes provide a convenient way to delete all elements or -// values from STL containers when they goes out of scope. This greatly -// simplifies code that creates temporary objects and has multiple return -// statements. Example: -// -// vector<MyProto *> tmp_proto; -// STLElementDeleter<vector<MyProto *> > d(&tmp_proto); -// if (...) return false; -// ... -// return success; - -// Given a pointer to an STL container this class will delete all the element -// pointers when it goes out of scope. - -template<class STLContainer> class STLElementDeleter { - public: - STLElementDeleter<STLContainer>(STLContainer *ptr) : container_ptr_(ptr) {} - ~STLElementDeleter<STLContainer>() { STLDeleteElements(container_ptr_); } - private: - STLContainer *container_ptr_; -}; - -// Given a pointer to an STL container this class will delete all the value -// pointers when it goes out of scope. - -template<class STLContainer> class STLValueDeleter { - public: - STLValueDeleter<STLContainer>(STLContainer *ptr) : container_ptr_(ptr) {} - ~STLValueDeleter<STLContainer>() { STLDeleteValues(container_ptr_); } - private: - STLContainer *container_ptr_; -}; - - -// Forward declare some callback classes in callback.h for STLBinaryFunction -template <class R, class T1, class T2> -class ResultCallback2; - -// STLBinaryFunction is a wrapper for the ResultCallback2 class in callback.h -// It provides an operator () method instead of a Run method, so it may be -// passed to STL functions in <algorithm>. -// -// The client should create callback with NewPermanentCallback, and should -// delete callback after it is done using the STLBinaryFunction. - -template <class Result, class Arg1, class Arg2> -class STLBinaryFunction : public std::binary_function<Arg1, Arg2, Result> { - public: - typedef ResultCallback2<Result, Arg1, Arg2> Callback; - - STLBinaryFunction(Callback* callback) - : callback_(callback) { - assert(callback_); - } - - Result operator() (Arg1 arg1, Arg2 arg2) { - return callback_->Run(arg1, arg2); - } - - private: - Callback* callback_; -}; - -// STLBinaryPredicate is a specialized version of STLBinaryFunction, where the -// return type is bool and both arguments have type Arg. It can be used -// wherever STL requires a StrictWeakOrdering, such as in sort() or -// lower_bound(). -// -// templated typedefs are not supported, so instead we use inheritance. - -template <class Arg> -class STLBinaryPredicate : public STLBinaryFunction<bool, Arg, Arg> { - public: - typedef typename STLBinaryPredicate<Arg>::Callback Callback; - STLBinaryPredicate(Callback* callback) - : STLBinaryFunction<bool, Arg, Arg>(callback) { - } -}; - -// Functors that compose arbitrary unary and binary functions with a -// function that "projects" one of the members of a pair. -// Specifically, if p1 and p2, respectively, are the functions that -// map a pair to its first and second, respectively, members, the -// table below summarizes the functions that can be constructed: -// -// * UnaryOperate1st<pair>(f) returns the function x -> f(p1(x)) -// * UnaryOperate2nd<pair>(f) returns the function x -> f(p2(x)) -// * BinaryOperate1st<pair>(f) returns the function (x,y) -> f(p1(x),p1(y)) -// * BinaryOperate2nd<pair>(f) returns the function (x,y) -> f(p2(x),p2(y)) -// -// A typical usage for these functions would be when iterating over -// the contents of an STL map. For other sample usage, see the unittest. - -template<typename Pair, typename UnaryOp> -class UnaryOperateOnFirst - : public std::unary_function<Pair, typename UnaryOp::result_type> { - public: - UnaryOperateOnFirst() { - } - - UnaryOperateOnFirst(const UnaryOp& f) : f_(f) { - } - - typename UnaryOp::result_type operator()(const Pair& p) const { - return f_(p.first); - } - - private: - UnaryOp f_; -}; - -template<typename Pair, typename UnaryOp> -UnaryOperateOnFirst<Pair, UnaryOp> UnaryOperate1st(const UnaryOp& f) { - return UnaryOperateOnFirst<Pair, UnaryOp>(f); -} - -template<typename Pair, typename UnaryOp> -class UnaryOperateOnSecond - : public std::unary_function<Pair, typename UnaryOp::result_type> { - public: - UnaryOperateOnSecond() { - } - - UnaryOperateOnSecond(const UnaryOp& f) : f_(f) { - } - - typename UnaryOp::result_type operator()(const Pair& p) const { - return f_(p.second); - } - - private: - UnaryOp f_; -}; - -template<typename Pair, typename UnaryOp> -UnaryOperateOnSecond<Pair, UnaryOp> UnaryOperate2nd(const UnaryOp& f) { - return UnaryOperateOnSecond<Pair, UnaryOp>(f); -} - -template<typename Pair, typename BinaryOp> -class BinaryOperateOnFirst - : public std::binary_function<Pair, Pair, typename BinaryOp::result_type> { - public: - BinaryOperateOnFirst() { - } - - BinaryOperateOnFirst(const BinaryOp& f) : f_(f) { - } - - typename BinaryOp::result_type operator()(const Pair& p1, - const Pair& p2) const { - return f_(p1.first, p2.first); - } - - private: - BinaryOp f_; -}; - -template<typename Pair, typename BinaryOp> -BinaryOperateOnFirst<Pair, BinaryOp> BinaryOperate1st(const BinaryOp& f) { - return BinaryOperateOnFirst<Pair, BinaryOp>(f); -} - -template<typename Pair, typename BinaryOp> -class BinaryOperateOnSecond - : public std::binary_function<Pair, Pair, typename BinaryOp::result_type> { - public: - BinaryOperateOnSecond() { - } - - BinaryOperateOnSecond(const BinaryOp& f) : f_(f) { - } - - typename BinaryOp::result_type operator()(const Pair& p1, - const Pair& p2) const { - return f_(p1.second, p2.second); - } - - private: - BinaryOp f_; -}; - -template<typename Pair, typename BinaryOp> -BinaryOperateOnSecond<Pair, BinaryOp> BinaryOperate2nd(const BinaryOp& f) { - return BinaryOperateOnSecond<Pair, BinaryOp>(f); -} - -// Translates a set into a vector. -template<typename T> -std::vector<T> SetToVector(const std::set<T>& values) { - std::vector<T> result; - result.reserve(values.size()); - result.insert(result.begin(), values.begin(), values.end()); - return result; -} - -#endif // CHROME_COMMON_STL_UTIL_INL_H__ diff --git a/chrome/common/task_queue.cc b/chrome/common/task_queue.cc index bb73150..0d5aabb 100644 --- a/chrome/common/task_queue.cc +++ b/chrome/common/task_queue.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/stl_util-inl.h" - #include "chrome/common/task_queue.h" +#include "base/stl_util-inl.h" + TaskQueue::TaskQueue() { } diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc index 5fd9485..6d0b7d1 100644 --- a/chrome/common/time_format.cc +++ b/chrome/common/time_format.cc @@ -9,11 +9,11 @@ #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/singleton.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" #include "base/time_format.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/stl_util-inl.h" #include "grit/generated_resources.h" #include "unicode/datefmt.h" #include "unicode/locid.h" diff --git a/chrome/renderer/dom_ui_bindings.cc b/chrome/renderer/dom_ui_bindings.cc index 8e9373e..ff9ef18 100644 --- a/chrome/renderer/dom_ui_bindings.cc +++ b/chrome/renderer/dom_ui_bindings.cc @@ -5,9 +5,9 @@ #include "chrome/renderer/dom_ui_bindings.h" #include "base/json_writer.h" +#include "base/stl_util-inl.h" #include "base/values.h" #include "chrome/common/render_messages.h" -#include "chrome/common/stl_util-inl.h" DOMBoundBrowserObject::~DOMBoundBrowserObject() { STLDeleteContainerPointers(properties_.begin(), properties_.end()); diff --git a/chrome/renderer/user_script_slave.h b/chrome/renderer/user_script_slave.h index b8b80a1..dcc1c7d 100644 --- a/chrome/renderer/user_script_slave.h +++ b/chrome/renderer/user_script_slave.h @@ -10,9 +10,9 @@ #include "base/scoped_ptr.h" #include "base/shared_memory.h" +#include "base/stl_util-inl.h" #include "base/string_piece.h" #include "chrome/common/extensions/user_script.h" -#include "chrome/common/stl_util-inl.h" class WebFrame; diff --git a/chrome/third_party/hunspell/src/hunspell/hashmgr.hxx b/chrome/third_party/hunspell/src/hunspell/hashmgr.hxx index 6b68988..781175e5 100644 --- a/chrome/third_party/hunspell/src/hunspell/hashmgr.hxx +++ b/chrome/third_party/hunspell/src/hunspell/hashmgr.hxx @@ -5,11 +5,12 @@ #include "htypes.hxx" #ifdef HUNSPELL_CHROME_CLIENT -#include "chrome/common/stl_util-inl.h" -#include "chrome/third_party/hunspell/google/bdict_reader.h" -#include "base/string_piece.h" #include <string> #include <map> + +#include "base/stl_util-inl.h" +#include "base/string_piece.h" +#include "chrome/third_party/hunspell/google/bdict_reader.h" #endif enum flag { FLAG_CHAR, FLAG_LONG, FLAG_NUM, FLAG_UNI }; diff --git a/chrome/views/controls/menu/menu.cc b/chrome/views/controls/menu/menu.cc index c8567b6..050c3fa 100644 --- a/chrome/views/controls/menu/menu.cc +++ b/chrome/views/controls/menu/menu.cc @@ -14,13 +14,13 @@ #include "base/gfx/rect.h" #include "base/logging.h" -#include "chrome/views/accelerator.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/stl_util-inl.h" +#include "chrome/views/accelerator.h" const SkBitmap* Menu::Delegate::kEmptyIcon = 0; @@ -151,7 +151,7 @@ class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow, // Draw the label. RECT rect = lpdis->rcItem; rect.top += kItemTopMargin; - // Should we add kIconWidth only when icon.width() != 0 ? + // Should we add kIconWidth only when icon.width() != 0 ? rect.left += kItemLeftMargin + kIconWidth; rect.right -= kItemRightMargin; UINT format = DT_TOP | DT_SINGLELINE; @@ -164,11 +164,11 @@ class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow, HGDIOBJ old_font = static_cast<HFONT>(SelectObject(hDC, font.hfont())); int fontsize = font.FontSize(); - // If an accelerator is specified (with a tab delimiting the rest - // of the label from the accelerator), we have to justify - // the fist part on the left and the accelerator on the right. - // TODO(jungshik): This will break in RTL UI. Currently, he/ar - // use the window system UI font and will not hit here. + // If an accelerator is specified (with a tab delimiting the rest of the + // label from the accelerator), we have to justify the fist part on the + // left and the accelerator on the right. + // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the + // window system UI font and will not hit here. std::wstring label = data->label; std::wstring accel; std::wstring::size_type tab_pos = label.find(L'\t'); diff --git a/chrome/views/controls/tabbed_pane.cc b/chrome/views/controls/tabbed_pane.cc index cfd49c7..6fac67c 100644 --- a/chrome/views/controls/tabbed_pane.cc +++ b/chrome/views/controls/tabbed_pane.cc @@ -9,10 +9,10 @@ #include "app/resource_bundle.h" #include "base/gfx/native_theme.h" #include "base/logging.h" +#include "base/stl_util-inl.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/common/throb_animation.h" #include "chrome/views/background.h" #include "chrome/views/fill_layout.h" diff --git a/chrome/views/controls/tree/tree_node_model.h b/chrome/views/controls/tree/tree_node_model.h index 884985a..14e5748 100644 --- a/chrome/views/controls/tree/tree_node_model.h +++ b/chrome/views/controls/tree/tree_node_model.h @@ -10,7 +10,8 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" -#include "chrome/common/scoped_vector.h" +#include "base/scoped_vector.h" +#include "base/stl_util-inl.h" #include "chrome/views/controls/tree/tree_model.h" namespace views { diff --git a/chrome/views/controls/tree/tree_view.cc b/chrome/views/controls/tree/tree_view.cc index a8367b2..e09711f 100644 --- a/chrome/views/controls/tree/tree_view.cc +++ b/chrome/views/controls/tree/tree_view.cc @@ -7,12 +7,12 @@ #include <shellapi.h> #include "app/resource_bundle.h" +#include "base/stl_util-inl.h" #include "base/win_util.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/icon_util.h" #include "chrome/common/l10n_util.h" #include "chrome/common/l10n_util_win.h" -#include "chrome/common/stl_util-inl.h" #include "chrome/views/focus/focus_manager.h" #include "chrome/views/widget/widget.h" #include "grit/theme_resources.h" diff --git a/chrome/views/focus/view_storage.cc b/chrome/views/focus/view_storage.cc index 94826ea..1a8324c 100644 --- a/chrome/views/focus/view_storage.cc +++ b/chrome/views/focus/view_storage.cc @@ -6,8 +6,8 @@ #include <algorithm> +#include "base/stl_util-inl.h" #include "chrome/common/notification_service.h" -#include "chrome/common/stl_util-inl.h" namespace views { |