summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 01:54:15 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 01:54:15 +0000
commit3b63f8f451afcf414a59c529f627c620e4d449d9 (patch)
tree2dcbab1c060b29a260c29bb19b67bf97a8293ca3 /base
parent9174a108509c2aafe513da68e6e63fbc7df38c85 (diff)
downloadchromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.zip
chromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.tar.gz
chromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.tar.bz2
Move some files from base to base/memory.
raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/atomic_ref_count.h4
-rw-r--r--base/base.gyp14
-rw-r--r--base/base.gypi40
-rw-r--r--base/base_paths_linux.cc4
-rw-r--r--base/callback_internal.h2
-rw-r--r--base/callback_old.h4
-rw-r--r--base/callback_unittest.cc4
-rw-r--r--base/command_line.cc2
-rw-r--r--base/crypto/capi_util.cc4
-rw-r--r--base/crypto/cssm_init.cc4
-rw-r--r--base/crypto/encryptor_unittest.cc4
-rw-r--r--base/crypto/mac_security_services_lock.cc2
-rw-r--r--base/crypto/rsa_private_key.cc4
-rw-r--r--base/crypto/rsa_private_key_mac.cc4
-rw-r--r--base/crypto/rsa_private_key_nss.cc4
-rw-r--r--base/crypto/rsa_private_key_nss_unittest.cc4
-rw-r--r--base/crypto/rsa_private_key_openssl.cc4
-rw-r--r--base/crypto/rsa_private_key_unittest.cc4
-rw-r--r--base/crypto/rsa_private_key_win.cc4
-rw-r--r--base/crypto/scoped_nss_types.h4
-rw-r--r--base/crypto/secure_hash_unittest.cc2
-rw-r--r--base/crypto/signature_creator_mac.cc4
-rw-r--r--base/crypto/signature_creator_nss.cc4
-rw-r--r--base/crypto/signature_creator_openssl.cc4
-rw-r--r--base/crypto/signature_creator_unittest.cc4
-rw-r--r--base/crypto/signature_creator_win.cc4
-rw-r--r--base/crypto/signature_verifier_openssl.cc4
-rw-r--r--base/crypto/symmetric_key_openssl.cc4
-rw-r--r--base/crypto/symmetric_key_unittest.cc4
-rw-r--r--base/crypto/symmetric_key_win.cc4
-rw-r--r--base/debug/debugger_posix.cc4
-rw-r--r--base/debug/leak_tracker_unittest.cc4
-rw-r--r--base/debug/stack_trace_posix.cc4
-rw-r--r--base/debug/stack_trace_win.cc4
-rw-r--r--base/debug/trace_event.h6
-rw-r--r--base/debug/trace_event_win.cc4
-rw-r--r--base/environment.cc4
-rw-r--r--base/environment_unittest.cc4
-rw-r--r--base/file_util.h2
-rw-r--r--base/file_util_posix.cc6
-rw-r--r--base/file_util_proxy.h2
-rw-r--r--base/file_util_unittest.cc2
-rw-r--r--base/file_version_info_mac.h4
-rw-r--r--base/file_version_info_unittest.cc4
-rw-r--r--base/file_version_info_win.h2
-rw-r--r--base/global_descriptors_posix.h2
-rw-r--r--base/hmac.h2
-rw-r--r--base/hmac_nss.cc4
-rw-r--r--base/hmac_openssl.cc4
-rw-r--r--base/i18n/file_util_icu.cc6
-rw-r--r--base/i18n/number_formatting.cc4
-rw-r--r--base/i18n/time_formatting.cc4
-rw-r--r--base/json/json_reader.cc4
-rw-r--r--base/json/json_reader_unittest.cc4
-rw-r--r--base/linux_util.cc6
-rw-r--r--base/logging_win.cc4
-rw-r--r--base/mac/mac_util.mm2
-rw-r--r--base/mac/mac_util_unittest.mm2
-rw-r--r--base/memory/linked_ptr.h (renamed from base/linked_ptr.h)8
-rw-r--r--base/memory/linked_ptr_unittest.cc (renamed from base/linked_ptr_unittest.cc)4
-rw-r--r--base/memory/memory_debug.cc (renamed from base/memory_debug.cc)4
-rw-r--r--base/memory/memory_debug.h (renamed from base/memory_debug.h)8
-rw-r--r--base/memory/raw_scoped_refptr_mismatch_checker.h (renamed from base/raw_scoped_refptr_mismatch_checker.h)10
-rw-r--r--base/memory/ref_counted.cc (renamed from base/ref_counted.cc)4
-rw-r--r--base/memory/ref_counted.h299
-rw-r--r--base/memory/ref_counted_memory.cc (renamed from base/ref_counted_memory.cc)4
-rw-r--r--base/memory/ref_counted_memory.h (renamed from base/ref_counted_memory.h)8
-rw-r--r--base/memory/ref_counted_unittest.cc (renamed from base/ref_counted_unittest.cc)4
-rw-r--r--base/memory/scoped_callback_factory.h (renamed from base/scoped_callback_factory.h)10
-rw-r--r--base/memory/scoped_handle.h (renamed from base/scoped_handle.h)6
-rw-r--r--base/memory/scoped_native_library.cc (renamed from base/scoped_native_library.cc)4
-rw-r--r--base/memory/scoped_native_library.h (renamed from base/scoped_native_library.h)6
-rw-r--r--base/memory/scoped_native_library_unittest.cc (renamed from base/scoped_native_library_unittest.cc)4
-rw-r--r--base/memory/scoped_nsobject.h (renamed from base/scoped_nsobject.h)8
-rw-r--r--base/memory/scoped_open_process.h (renamed from base/scoped_open_process.h)8
-rw-r--r--base/memory/scoped_ptr.h383
-rw-r--r--base/memory/scoped_ptr_unittest.cc (renamed from base/scoped_ptr_unittest.cc)4
-rw-r--r--base/memory/scoped_temp_dir.cc (renamed from base/scoped_temp_dir.cc)4
-rw-r--r--base/memory/scoped_temp_dir.h (renamed from base/scoped_temp_dir.h)6
-rw-r--r--base/memory/scoped_temp_dir_unittest.cc (renamed from base/scoped_temp_dir_unittest.cc)4
-rw-r--r--base/memory/scoped_vector.h (renamed from base/scoped_vector.h)8
-rw-r--r--base/memory/singleton.h (renamed from base/singleton.h)10
-rw-r--r--base/memory/singleton_objc.h (renamed from base/singleton_objc.h)10
-rw-r--r--base/memory/singleton_unittest.cc (renamed from base/singleton_unittest.cc)4
-rw-r--r--base/memory/weak_ptr.cc (renamed from base/weak_ptr.cc)4
-rw-r--r--base/memory/weak_ptr.h (renamed from base/weak_ptr.h)8
-rw-r--r--base/memory/weak_ptr_unittest.cc (renamed from base/weak_ptr_unittest.cc)6
-rw-r--r--base/message_loop.h2
-rw-r--r--base/message_loop_proxy.h2
-rw-r--r--base/message_loop_proxy_impl_unittest.cc4
-rw-r--r--base/message_loop_unittest.cc2
-rw-r--r--base/message_pump.h2
-rw-r--r--base/message_pump_glib.h2
-rw-r--r--base/message_pump_glib_unittest.cc4
-rw-r--r--base/message_pump_libevent.cc4
-rw-r--r--base/metrics/field_trial.h2
-rw-r--r--base/metrics/histogram.h2
-rw-r--r--base/metrics/stats_table.cc2
-rw-r--r--base/mime_util_xdg.cc6
-rw-r--r--base/nss_util.cc4
-rw-r--r--base/observer_list_threadsafe.h4
-rw-r--r--base/observer_list_unittest.cc4
-rw-r--r--base/openssl_util.cc6
-rw-r--r--base/pickle_unittest.cc4
-rw-r--r--base/platform_file_unittest.cc4
-rw-r--r--base/process_util_posix.cc4
-rw-r--r--base/process_util_unittest.cc4
-rw-r--r--base/process_util_win.cc4
-rw-r--r--base/process_win.cc4
-rw-r--r--base/ref_counted.h292
-rw-r--r--base/scoped_ptr.h378
-rw-r--r--base/shared_memory_unittest.cc4
-rw-r--r--base/stack_container_unittest.cc4
-rw-r--r--base/string_util.cc4
-rw-r--r--base/synchronization/condition_variable_unittest.cc2
-rw-r--r--base/synchronization/waitable_event.h2
-rw-r--r--base/sys_info_win.cc2
-rw-r--r--base/task.h4
-rw-r--r--base/task_queue_unittest.cc4
-rw-r--r--base/task_unittest.cc4
-rw-r--r--base/test/test_suite.cc2
-rw-r--r--base/threading/non_thread_safe_unittest.cc4
-rw-r--r--base/threading/platform_thread_posix.cc4
-rw-r--r--base/threading/thread_checker_unittest.cc4
-rw-r--r--base/threading/thread_collision_warner_unittest.cc4
-rw-r--r--base/threading/worker_pool_posix.cc4
-rw-r--r--base/threading/worker_pool_posix.h6
-rw-r--r--base/time_win.cc4
-rw-r--r--base/timer_unittest.cc4
-rw-r--r--base/values_unittest.cc4
-rw-r--r--base/version_unittest.cc4
-rw-r--r--base/win/scoped_comptr.h4
-rw-r--r--base/win/scoped_comptr_unittest.cc6
-rw-r--r--base/win/win_util.cc2
134 files changed, 986 insertions, 958 deletions
diff --git a/base/atomic_ref_count.h b/base/atomic_ref_count.h
index dff4b1f..985c42c 100644
--- a/base/atomic_ref_count.h
+++ b/base/atomic_ref_count.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
// This is a low level implementation of atomic semantics for reference
-// counting. Please use base/ref_counted.h directly instead.
+// counting. Please use base/memory/ref_counted.h directly instead.
//
// The implementation includes annotations to avoid some false positives
// when using data race detection tools.
diff --git a/base/base.gyp b/base/base.gyp
index fcf0b88..1315c96 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -99,9 +99,15 @@
'json/string_escape_unittest.cc',
'lazy_instance_unittest.cc',
'linked_list_unittest.cc',
- 'linked_ptr_unittest.cc',
'logging_unittest.cc',
'mac/mac_util_unittest.mm',
+ 'memory/linked_ptr_unittest.cc',
+ 'memory/ref_counted_unittest.cc',
+ 'memory/scoped_native_library_unittest.cc',
+ 'memory/scoped_ptr_unittest.cc',
+ 'memory/scoped_temp_dir_unittest.cc',
+ 'memory/singleton_unittest.cc',
+ 'memory/weak_ptr_unittest.cc',
'message_loop_proxy_impl_unittest.cc',
'message_loop_unittest.cc',
'message_pump_glib_unittest.cc',
@@ -117,14 +123,9 @@
'process_util_unittest_mac.h',
'process_util_unittest_mac.mm',
'rand_util_unittest.cc',
- 'ref_counted_unittest.cc',
- 'scoped_native_library_unittest.cc',
- 'scoped_ptr_unittest.cc',
- 'scoped_temp_dir_unittest.cc',
'sha1_unittest.cc',
'sha2_unittest.cc',
'shared_memory_unittest.cc',
- 'singleton_unittest.cc',
'stack_container_unittest.cc',
'string16_unittest.cc',
'string_number_conversions_unittest.cc',
@@ -167,7 +168,6 @@
'values_unittest.cc',
'version_unittest.cc',
'vlog_unittest.cc',
- 'weak_ptr_unittest.cc',
'win/event_trace_consumer_unittest.cc',
'win/event_trace_controller_unittest.cc',
'win/event_trace_provider_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index f48646d..7777cba8 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -107,7 +107,6 @@
'lazy_instance.cc',
'lazy_instance.h',
'linked_list.h',
- 'linked_ptr.h',
'logging.cc',
'logging.h',
'logging_win.cc',
@@ -124,8 +123,27 @@
'mac/scoped_nsautorelease_pool.mm',
'mach_ipc_mac.h',
'mach_ipc_mac.mm',
- 'memory_debug.cc',
- 'memory_debug.h',
+ 'memory/linked_ptr.h',
+ 'memory/memory_debug.cc',
+ 'memory/memory_debug.h',
+ 'memory/raw_scoped_refptr_mismatch_checker.h',
+ 'memory/ref_counted.cc',
+ 'memory/ref_counted.h',
+ 'memory/ref_counted_memory.cc',
+ 'memory/ref_counted_memory.h',
+ 'memory/scoped_callback_factory.h',
+ 'memory/scoped_handle.h',
+ 'memory/scoped_native_library.cc',
+ 'memory/scoped_native_library.h',
+ 'memory/scoped_nsobject.h',
+ 'memory/scoped_open_process.h',
+ 'memory/scoped_ptr.h',
+ 'memory/scoped_temp_dir.cc',
+ 'memory/scoped_temp_dir.h',
+ 'memory/scoped_vector.h',
+ 'memory/singleton.h',
+ 'memory/weak_ptr.cc',
+ 'memory/weak_ptr.h',
'message_loop.cc',
'message_loop.h',
'message_loop_proxy.cc',
@@ -177,32 +195,18 @@
'rand_util.h',
'rand_util_posix.cc',
'rand_util_win.cc',
- 'raw_scoped_refptr_mismatch_checker.h',
- 'ref_counted.cc',
'ref_counted.h',
- 'ref_counted_memory.cc',
- 'ref_counted_memory.h',
'resource_util.cc',
'resource_util.h',
'safe_strerror_posix.cc',
'safe_strerror_posix.h',
- 'scoped_callback_factory.h',
- 'scoped_handle.h',
- 'scoped_native_library.cc',
- 'scoped_native_library.h',
- 'scoped_nsobject.h',
- 'scoped_open_process.h',
'scoped_ptr.h',
- 'scoped_temp_dir.cc',
- 'scoped_temp_dir.h',
- 'scoped_vector.h',
'sha1.h',
'sha1_portable.cc',
'sha1_win.cc',
'shared_memory.h',
'shared_memory_posix.cc',
'shared_memory_win.cc',
- 'singleton.h',
'spin_wait.h',
'stack_container.h',
'stl_util-inl.h',
@@ -306,8 +310,6 @@
'version.h',
'vlog.cc',
'vlog.h',
- 'weak_ptr.cc',
- 'weak_ptr.h',
'win/i18n.cc',
'win/i18n.h',
'win/object_watcher.cc',
diff --git a/base/base_paths_linux.cc b/base/base_paths_linux.cc
index 8b1a0b8..c32bc19 100644
--- a/base/base_paths_linux.cc
+++ b/base/base_paths_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -14,8 +14,8 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
-#include "base/scoped_ptr.h"
#include "base/sys_string_conversions.h"
#include "base/nix/xdg_util.h"
diff --git a/base/callback_internal.h b/base/callback_internal.h
index 5ff55a0..c6c70cf 100644
--- a/base/callback_internal.h
+++ b/base/callback_internal.h
@@ -10,7 +10,7 @@
#pragma once
#include "base/base_api.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
namespace base {
namespace internal {
diff --git a/base/callback_old.h b/base/callback_old.h
index ab3927d..7719e66 100644
--- a/base/callback_old.h
+++ b/base/callback_old.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,8 +6,8 @@
#define BASE_CALLBACK_OLD_H_
#pragma once
+#include "base/memory/raw_scoped_refptr_mismatch_checker.h"
#include "base/tuple.h"
-#include "base/raw_scoped_refptr_mismatch_checker.h"
// Callback --------------------------------------------------------------------
//
diff --git a/base/callback_unittest.cc b/base/callback_unittest.cc
index f327412..da2f150 100644
--- a/base/callback_unittest.cc
+++ b/base/callback_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/callback.h"
#include "base/callback_internal.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/command_line.cc b/base/command_line.cc
index fcb2294..c5fd620 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
diff --git a/base/crypto/capi_util.cc b/base/crypto/capi_util.cc
index ef57a3c..1828afd 100644
--- a/base/crypto/capi_util.cc
+++ b/base/crypto/capi_util.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/crypto/capi_util.h"
#include "base/basictypes.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
namespace {
diff --git a/base/crypto/cssm_init.cc b/base/crypto/cssm_init.cc
index 3071716..ccd6993 100644
--- a/base/crypto/cssm_init.cc
+++ b/base/crypto/cssm_init.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/sys_string_conversions.h"
// When writing crypto code for Mac OS X, you may find the following
diff --git a/base/crypto/encryptor_unittest.cc b/base/crypto/encryptor_unittest.cc
index e8d055b..5060b2a 100644
--- a/base/crypto/encryptor_unittest.cc
+++ b/base/crypto/encryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,7 +7,7 @@
#include <string>
#include "base/crypto/symmetric_key.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/crypto/mac_security_services_lock.cc b/base/crypto/mac_security_services_lock.cc
index df1e3ce..d68d757 100644
--- a/base/crypto/mac_security_services_lock.cc
+++ b/base/crypto/mac_security_services_lock.cc
@@ -4,7 +4,7 @@
#include "base/crypto/mac_security_services_lock.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
namespace {
diff --git a/base/crypto/rsa_private_key.cc b/base/crypto/rsa_private_key.cc
index 024f741..c4464f1 100644
--- a/base/crypto/rsa_private_key.cc
+++ b/base/crypto/rsa_private_key.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,7 +8,7 @@
#include <list>
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
// This file manually encodes and decodes RSA private keys using PrivateKeyInfo
diff --git a/base/crypto/rsa_private_key_mac.cc b/base/crypto/rsa_private_key_mac.cc
index ede8014..35f9104 100644
--- a/base/crypto/rsa_private_key_mac.cc
+++ b/base/crypto/rsa_private_key_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,7 +8,7 @@
#include "base/crypto/cssm_init.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/crypto/rsa_private_key_nss.cc b/base/crypto/rsa_private_key_nss.cc
index 202aa1d..e952c89 100644
--- a/base/crypto/rsa_private_key_nss.cc
+++ b/base/crypto/rsa_private_key_nss.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -12,9 +12,9 @@
#include "base/debug/leak_annotations.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/nss_util.h"
#include "base/nss_util_internal.h"
-#include "base/scoped_ptr.h"
#include "base/string_util.h"
// TODO(rafaelw): Consider refactoring common functions and definitions from
diff --git a/base/crypto/rsa_private_key_nss_unittest.cc b/base/crypto/rsa_private_key_nss_unittest.cc
index 7dbe628..f132d37 100644
--- a/base/crypto/rsa_private_key_nss_unittest.cc
+++ b/base/crypto/rsa_private_key_nss_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,8 +7,8 @@
#include <keyhi.h>
#include <pk11pub.h>
+#include "base/memory/scoped_ptr.h"
#include "base/nss_util.h"
-#include "base/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
diff --git a/base/crypto/rsa_private_key_openssl.cc b/base/crypto/rsa_private_key_openssl.cc
index 891ea52..3dc6223 100644
--- a/base/crypto/rsa_private_key_openssl.cc
+++ b/base/crypto/rsa_private_key_openssl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,8 +9,8 @@
#include <openssl/rsa.h>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/openssl_util.h"
-#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
namespace base {
diff --git a/base/crypto/rsa_private_key_unittest.cc b/base/crypto/rsa_private_key_unittest.cc
index 3b0d846..1d9a249 100644
--- a/base/crypto/rsa_private_key_unittest.cc
+++ b/base/crypto/rsa_private_key_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/crypto/rsa_private_key.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
// Generate random private keys with two different sizes. Reimport, then
diff --git a/base/crypto/rsa_private_key_win.cc b/base/crypto/rsa_private_key_win.cc
index 6c8a34b..20e91a9 100644
--- a/base/crypto/rsa_private_key_win.cc
+++ b/base/crypto/rsa_private_key_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,7 +7,7 @@
#include <list>
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
namespace {
diff --git a/base/crypto/scoped_nss_types.h b/base/crypto/scoped_nss_types.h
index 664251f..4a77f88 100644
--- a/base/crypto/scoped_nss_types.h
+++ b/base/crypto/scoped_nss_types.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,7 +9,7 @@
#include <nss.h>
#include <pk11pub.h>
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/crypto/secure_hash_unittest.cc b/base/crypto/secure_hash_unittest.cc
index 2dac928..ca46dac 100644
--- a/base/crypto/secure_hash_unittest.cc
+++ b/base/crypto/secure_hash_unittest.cc
@@ -5,7 +5,7 @@
#include "base/crypto/secure_hash.h"
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/sha2.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/crypto/signature_creator_mac.cc b/base/crypto/signature_creator_mac.cc
index 1001c64..5c2d477 100644
--- a/base/crypto/signature_creator_mac.cc
+++ b/base/crypto/signature_creator_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,7 +8,7 @@
#include "base/crypto/cssm_init.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/crypto/signature_creator_nss.cc b/base/crypto/signature_creator_nss.cc
index 4cc2c10..92bf4d7 100644
--- a/base/crypto/signature_creator_nss.cc
+++ b/base/crypto/signature_creator_nss.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,8 +9,8 @@
#include <stdlib.h>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/nss_util.h"
-#include "base/scoped_ptr.h"
namespace base {
diff --git a/base/crypto/signature_creator_openssl.cc b/base/crypto/signature_creator_openssl.cc
index 5bdb783..cdf351f 100644
--- a/base/crypto/signature_creator_openssl.cc
+++ b/base/crypto/signature_creator_openssl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,8 +7,8 @@
#include <openssl/evp.h>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/openssl_util.h"
-#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
namespace base {
diff --git a/base/crypto/signature_creator_unittest.cc b/base/crypto/signature_creator_unittest.cc
index 11959cb..644ab7f 100644
--- a/base/crypto/signature_creator_unittest.cc
+++ b/base/crypto/signature_creator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,7 +6,7 @@
#include "base/crypto/signature_creator.h"
#include "base/crypto/signature_verifier.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(SignatureCreatorTest, BasicTest) {
diff --git a/base/crypto/signature_creator_win.cc b/base/crypto/signature_creator_win.cc
index 45924f0..7102007 100644
--- a/base/crypto/signature_creator_win.cc
+++ b/base/crypto/signature_creator_win.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/crypto/signature_creator.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/crypto/signature_verifier_openssl.cc b/base/crypto/signature_verifier_openssl.cc
index 4850efa..abfb553 100644
--- a/base/crypto/signature_verifier_openssl.cc
+++ b/base/crypto/signature_verifier_openssl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,8 +10,8 @@
#include <vector>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/openssl_util.h"
-#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
namespace base {
diff --git a/base/crypto/symmetric_key_openssl.cc b/base/crypto/symmetric_key_openssl.cc
index 409cce4..d055b61 100644
--- a/base/crypto/symmetric_key_openssl.cc
+++ b/base/crypto/symmetric_key_openssl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,8 +10,8 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/openssl_util.h"
-#include "base/scoped_ptr.h"
#include "base/string_util.h"
namespace base {
diff --git a/base/crypto/symmetric_key_unittest.cc b/base/crypto/symmetric_key_unittest.cc
index a9b0b9e..f9e9419 100644
--- a/base/crypto/symmetric_key_unittest.cc
+++ b/base/crypto/symmetric_key_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,7 +6,7 @@
#include <string>
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/crypto/symmetric_key_win.cc b/base/crypto/symmetric_key_win.cc
index 87d715a..0a1c234 100644
--- a/base/crypto/symmetric_key_win.cc
+++ b/base/crypto/symmetric_key_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,7 +9,7 @@
#include <vector>
// TODO(wtc): replace scoped_array by std::vector.
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index 2eacaf9..dfc3d0a 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -33,8 +33,8 @@
#include "base/basictypes.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/stringprintf.h"
diff --git a/base/debug/leak_tracker_unittest.cc b/base/debug/leak_tracker_unittest.cc
index 2e6a9a5..99df4c1 100644
--- a/base/debug/leak_tracker_unittest.cc
+++ b/base/debug/leak_tracker_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/debug/leak_tracker.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index abbd642..f1f5408 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -30,8 +30,8 @@
#include "base/basictypes.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/stringprintf.h"
diff --git a/base/debug/stack_trace_win.cc b/base/debug/stack_trace_win.cc
index 510d35b..f00017f 100644
--- a/base/debug/stack_trace_win.cc
+++ b/base/debug/stack_trace_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
namespace base {
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index 3eb1f49a..c3405fe 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -31,8 +31,8 @@
#include <string>
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
#include "base/time.h"
#include "base/timer.h"
diff --git a/base/debug/trace_event_win.cc b/base/debug/trace_event_win.cc
index 005ff62..4929944 100644
--- a/base/debug/trace_event_win.cc
+++ b/base/debug/trace_event_win.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/debug/trace_event_win.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include <initguid.h> // NOLINT
namespace base {
diff --git a/base/environment.cc b/base/environment.cc
index 9ccc0785..0bfc68e 100644
--- a/base/environment.cc
+++ b/base/environment.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -13,7 +13,7 @@
#include "base/string_util.h"
#if defined(OS_WIN)
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#endif
diff --git a/base/environment_unittest.cc b/base/environment_unittest.cc
index d1ce503..b6654c9 100644
--- a/base/environment_unittest.cc
+++ b/base/environment_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/environment.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/base/file_util.h b/base/file_util.h
index 77ccf2b..6fe9a3d 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -29,8 +29,8 @@
#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
-#include "base/scoped_ptr.h"
#include "base/string16.h"
#if defined(OS_POSIX)
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 8df0d27..5e1214b 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -34,8 +34,8 @@
#include "base/eintr_wrapper.h"
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/threading/thread_restrictions.h"
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index f2368cc..f975dac 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -10,8 +10,8 @@
#include "base/callback.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
-#include "base/ref_counted.h"
#include "base/tracked_objects.h"
namespace base {
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 85b650a..733f9f1 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -18,8 +18,8 @@
#include "base/base_paths.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/memory/scoped_temp_dir.h"
#include "base/path_service.h"
-#include "base/scoped_temp_dir.h"
#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h
index d8cb1a6..7c0184a 100644
--- a/base/file_version_info_mac.h
+++ b/base/file_version_info_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,7 +9,7 @@
#include <string>
#include "base/file_version_info.h"
-#include "base/scoped_nsobject.h"
+#include "base/memory/scoped_nsobject.h"
#ifdef __OBJC__
@class NSBundle;
diff --git a/base/file_version_info_unittest.cc b/base/file_version_info_unittest.cc
index 2b535c7..4184e04 100644
--- a/base/file_version_info_unittest.cc
+++ b/base/file_version_info_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/file_util.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
-#include "base/scoped_ptr.h"
#include "base/file_version_info.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h
index fabc1c9..95652b0 100644
--- a/base/file_version_info_win.h
+++ b/base/file_version_info_win.h
@@ -11,7 +11,7 @@
#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/file_version_info.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
struct tagVS_FIXEDFILEINFO;
typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
diff --git a/base/global_descriptors_posix.h b/base/global_descriptors_posix.h
index 060bf0a..d635cff 100644
--- a/base/global_descriptors_posix.h
+++ b/base/global_descriptors_posix.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
namespace base {
diff --git a/base/hmac.h b/base/hmac.h
index 3b1a9fd..2593307 100644
--- a/base/hmac.h
+++ b/base/hmac.h
@@ -13,7 +13,7 @@
#include "base/base_api.h"
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
namespace base {
diff --git a/base/hmac_nss.cc b/base/hmac_nss.cc
index af0b3eb..658616b 100644
--- a/base/hmac_nss.cc
+++ b/base/hmac_nss.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,8 +9,8 @@
#include "base/crypto/scoped_nss_types.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/nss_util.h"
-#include "base/scoped_ptr.h"
namespace base {
diff --git a/base/hmac_openssl.cc b/base/hmac_openssl.cc
index f45d3a7..64ce177 100644
--- a/base/hmac_openssl.cc
+++ b/base/hmac_openssl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,8 +10,8 @@
#include <vector>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/openssl_util.h"
-#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
namespace base {
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc
index ba69da0..9d12097 100644
--- a/base/i18n/file_util_icu.cc
+++ b/base/i18n/file_util_icu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,8 +8,8 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/sys_string_conversions.h"
diff --git a/base/i18n/number_formatting.cc b/base/i18n/number_formatting.cc
index df6af14..6b28de5 100644
--- a/base/i18n/number_formatting.cc
+++ b/base/i18n/number_formatting.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,7 +7,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/lazy_instance.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "unicode/numfmt.h"
diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc
index 3fa984a..823f7a6 100644
--- a/base/i18n/time_formatting.cc
+++ b/base/i18n/time_formatting.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/i18n/time_formatting.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "base/time.h"
#include "unicode/datefmt.h"
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index c8fe78d..82bc7d4 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,7 +6,7 @@
#include "base/float_util.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index db0ab63..a7aeaf0 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "testing/gtest/include/gtest/gtest.h"
#include "base/json/json_reader.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 4e7cc5c..725c602 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -17,10 +17,10 @@
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "base/singleton.h"
-#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/synchronization/lock.h"
diff --git a/base/logging_win.cc b/base/logging_win.cc
index f780b5e..a714665 100644
--- a/base/logging_win.cc
+++ b/base/logging_win.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/logging_win.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include <initguid.h> // NOLINT
namespace logging {
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index 2eddeae..cd3a9de 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/scoped_nsobject.h"
+#include "base/memory/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
namespace base {
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index bae0019..b4f9268 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/scoped_nsobject.h"
+#include "base/memory/scoped_nsobject.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/base/linked_ptr.h b/base/memory/linked_ptr.h
index 162798d..41931d8 100644
--- a/base/linked_ptr.h
+++ b/base/memory/linked_ptr.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
//
@@ -34,8 +34,8 @@
// - is thread safe for copying and deletion
// - supports weak_ptrs
-#ifndef BASE_LINKED_PTR_H_
-#define BASE_LINKED_PTR_H_
+#ifndef BASE_MEMORY_LINKED_PTR_H_
+#define BASE_MEMORY_LINKED_PTR_H_
#pragma once
#include "base/logging.h" // for CHECK macros
@@ -179,4 +179,4 @@ linked_ptr<T> make_linked_ptr(T* ptr) {
return linked_ptr<T>(ptr);
}
-#endif // BASE_LINKED_PTR_H_
+#endif // BASE_MEMORY_LINKED_PTR_H_
diff --git a/base/linked_ptr_unittest.cc b/base/memory/linked_ptr_unittest.cc
index e65b687..ae10fc28 100644
--- a/base/linked_ptr_unittest.cc
+++ b/base/memory/linked_ptr_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include <string>
-#include "base/linked_ptr.h"
+#include "base/memory/linked_ptr.h"
#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/memory_debug.cc b/base/memory/memory_debug.cc
index 7d048e6..f020b94 100644
--- a/base/memory_debug.cc
+++ b/base/memory/memory_debug.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/memory_debug.h"
+#include "base/memory/memory_debug.h"
#ifdef PURIFY
// this #define is used to prevent people from directly using pure.h
diff --git a/base/memory_debug.h b/base/memory/memory_debug.h
index 6d8c7f9..9cc6c61 100644
--- a/base/memory_debug.h
+++ b/base/memory/memory_debug.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,8 +6,8 @@
// All methods are effectively no-ops unless this program is being run through
// a supported memory tool (currently, only Purify)
-#ifndef BASE_MEMORY_DEBUG_H_
-#define BASE_MEMORY_DEBUG_H_
+#ifndef BASE_MEMORY_MEMORY_DEBUG_H_
+#define BASE_MEMORY_MEMORY_DEBUG_H_
#pragma once
#include "base/basictypes.h"
@@ -44,4 +44,4 @@ class MemoryDebug {
} // namespace base
-#endif // BASE_MEMORY_DEBUG_H_
+#endif // BASE_MEMORY_MEMORY_DEBUG_H_
diff --git a/base/raw_scoped_refptr_mismatch_checker.h b/base/memory/raw_scoped_refptr_mismatch_checker.h
index b79cfb5..a4a50c3 100644
--- a/base/raw_scoped_refptr_mismatch_checker.h
+++ b/base/memory/raw_scoped_refptr_mismatch_checker.h
@@ -1,12 +1,12 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 BASE_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
-#define BASE_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
+#ifndef BASE_MEMORY_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
+#define BASE_MEMORY_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
#pragma once
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/template_util.h"
#include "base/tuple.h"
#include "build/build_config.h"
@@ -127,4 +127,4 @@ struct ParamsUseScopedRefptrCorrectly<Tuple8<A, B, C, D, E, F, G, H> > {
} // namespace base
-#endif // BASE_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
+#endif // BASE_MEMORY_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
diff --git a/base/ref_counted.cc b/base/memory/ref_counted.cc
index 2d459ae..31ad509 100644
--- a/base/ref_counted.cc
+++ b/base/memory/ref_counted.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/logging.h"
#include "base/threading/thread_collision_warner.h"
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h
new file mode 100644
index 0000000..1207ed4
--- /dev/null
+++ b/base/memory/ref_counted.h
@@ -0,0 +1,299 @@
+// Copyright (c) 2011 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 BASE_MEMORY_REF_COUNTED_H_
+#define BASE_MEMORY_REF_COUNTED_H_
+#pragma once
+
+#include "base/atomic_ref_count.h"
+#include "base/base_api.h"
+#include "base/threading/thread_collision_warner.h"
+
+namespace base {
+
+namespace subtle {
+
+class BASE_API RefCountedBase {
+ public:
+ static bool ImplementsThreadSafeReferenceCounting() { return false; }
+
+ bool HasOneRef() const { return ref_count_ == 1; }
+
+ protected:
+ RefCountedBase();
+ ~RefCountedBase();
+
+ void AddRef() const;
+
+ // Returns true if the object should self-delete.
+ bool Release() const;
+
+ private:
+ mutable int ref_count_;
+#ifndef NDEBUG
+ mutable bool in_dtor_;
+#endif
+
+ DFAKE_MUTEX(add_release_);
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
+};
+
+class BASE_API RefCountedThreadSafeBase {
+ public:
+ static bool ImplementsThreadSafeReferenceCounting() { return true; }
+
+ bool HasOneRef() const;
+
+ protected:
+ RefCountedThreadSafeBase();
+ ~RefCountedThreadSafeBase();
+
+ void AddRef() const;
+
+ // Returns true if the object should self-delete.
+ bool Release() const;
+
+ private:
+ mutable AtomicRefCount ref_count_;
+#ifndef NDEBUG
+ mutable bool in_dtor_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
+};
+
+} // namespace subtle
+
+//
+// A base class for reference counted classes. Otherwise, known as a cheap
+// knock-off of WebKit's RefCounted<T> class. To use this guy just extend your
+// class from it like so:
+//
+// class MyFoo : public base::RefCounted<MyFoo> {
+// ...
+// private:
+// friend class base::RefCounted<MyFoo>;
+// ~MyFoo();
+// };
+//
+// You should always make your destructor private, to avoid any code deleting
+// the object accidently while there are references to it.
+template <class T>
+class RefCounted : public subtle::RefCountedBase {
+ public:
+ RefCounted() { }
+ ~RefCounted() { }
+
+ void AddRef() const {
+ subtle::RefCountedBase::AddRef();
+ }
+
+ void Release() const {
+ if (subtle::RefCountedBase::Release()) {
+ delete static_cast<const T*>(this);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RefCounted<T>);
+};
+
+// Forward declaration.
+template <class T, typename Traits> class RefCountedThreadSafe;
+
+// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
+// count reaches 0. Overload to delete it on a different thread etc.
+template<typename T>
+struct DefaultRefCountedThreadSafeTraits {
+ static void Destruct(const T* x) {
+ // Delete through RefCountedThreadSafe to make child classes only need to be
+ // friend with RefCountedThreadSafe instead of this struct, which is an
+ // implementation detail.
+ RefCountedThreadSafe<T,
+ DefaultRefCountedThreadSafeTraits>::DeleteInternal(x);
+ }
+};
+
+//
+// A thread-safe variant of RefCounted<T>
+//
+// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
+// ...
+// };
+//
+// If you're using the default trait, then you should add compile time
+// asserts that no one else is deleting your object. i.e.
+// private:
+// friend class base::RefCountedThreadSafe<MyFoo>;
+// ~MyFoo();
+template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
+class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase {
+ public:
+ RefCountedThreadSafe() { }
+ ~RefCountedThreadSafe() { }
+
+ void AddRef() const {
+ subtle::RefCountedThreadSafeBase::AddRef();
+ }
+
+ void Release() const {
+ if (subtle::RefCountedThreadSafeBase::Release()) {
+ Traits::Destruct(static_cast<const T*>(this));
+ }
+ }
+
+ private:
+ friend struct DefaultRefCountedThreadSafeTraits<T>;
+ static void DeleteInternal(const T* x) { delete x; }
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
+};
+
+//
+// A wrapper for some piece of data so we can place other things in
+// scoped_refptrs<>.
+//
+template<typename T>
+class RefCountedData : public base::RefCounted< base::RefCountedData<T> > {
+ public:
+ RefCountedData() : data() {}
+ RefCountedData(const T& in_value) : data(in_value) {}
+
+ T data;
+};
+
+} // namespace base
+
+//
+// A smart pointer class for reference counted objects. Use this class instead
+// of calling AddRef and Release manually on a reference counted object to
+// avoid common memory leaks caused by forgetting to Release an object
+// reference. Sample usage:
+//
+// class MyFoo : public RefCounted<MyFoo> {
+// ...
+// };
+//
+// void some_function() {
+// scoped_refptr<MyFoo> foo = new MyFoo();
+// foo->Method(param);
+// // |foo| is released when this function returns
+// }
+//
+// void some_other_function() {
+// scoped_refptr<MyFoo> foo = new MyFoo();
+// ...
+// foo = NULL; // explicitly releases |foo|
+// ...
+// if (foo)
+// foo->Method(param);
+// }
+//
+// The above examples show how scoped_refptr<T> acts like a pointer to T.
+// Given two scoped_refptr<T> classes, it is also possible to exchange
+// references between the two objects, like so:
+//
+// {
+// scoped_refptr<MyFoo> a = new MyFoo();
+// scoped_refptr<MyFoo> b;
+//
+// b.swap(a);
+// // now, |b| references the MyFoo object, and |a| references NULL.
+// }
+//
+// To make both |a| and |b| in the above example reference the same MyFoo
+// object, simply use the assignment operator:
+//
+// {
+// scoped_refptr<MyFoo> a = new MyFoo();
+// scoped_refptr<MyFoo> b;
+//
+// b = a;
+// // now, |a| and |b| each own a reference to the same MyFoo object.
+// }
+//
+template <class T>
+class scoped_refptr {
+ public:
+ scoped_refptr() : ptr_(NULL) {
+ }
+
+ scoped_refptr(T* p) : ptr_(p) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ template <typename U>
+ scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ ~scoped_refptr() {
+ if (ptr_)
+ ptr_->Release();
+ }
+
+ T* get() const { return ptr_; }
+ operator T*() const { return ptr_; }
+ T* operator->() const { return ptr_; }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ T* release() {
+ T* retVal = ptr_;
+ ptr_ = NULL;
+ return retVal;
+ }
+
+ scoped_refptr<T>& operator=(T* p) {
+ // AddRef first so that self assignment should work
+ if (p)
+ p->AddRef();
+ if (ptr_ )
+ ptr_ ->Release();
+ ptr_ = p;
+ return *this;
+ }
+
+ scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
+ return *this = r.ptr_;
+ }
+
+ template <typename U>
+ scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
+ return *this = r.get();
+ }
+
+ void swap(T** pp) {
+ T* p = ptr_;
+ ptr_ = *pp;
+ *pp = p;
+ }
+
+ void swap(scoped_refptr<T>& r) {
+ swap(&r.ptr_);
+ }
+
+ protected:
+ T* ptr_;
+};
+
+// Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
+// having to retype all the template arguments
+template <typename T>
+scoped_refptr<T> make_scoped_refptr(T* t) {
+ return scoped_refptr<T>(t);
+}
+
+#endif // BASE_MEMORY_REF_COUNTED_H_
diff --git a/base/ref_counted_memory.cc b/base/memory/ref_counted_memory.cc
index dc244b9..aa16031 100644
--- a/base/ref_counted_memory.cc
+++ b/base/memory/ref_counted_memory.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/ref_counted_memory.h"
+#include "base/memory/ref_counted_memory.h"
RefCountedMemory::RefCountedMemory() {
}
diff --git a/base/ref_counted_memory.h b/base/memory/ref_counted_memory.h
index fe7427e..db15792 100644
--- a/base/ref_counted_memory.h
+++ b/base/memory/ref_counted_memory.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_REF_COUNTED_MEMORY_H_
-#define BASE_REF_COUNTED_MEMORY_H_
+#ifndef BASE_MEMORY_REF_COUNTED_MEMORY_H_
+#define BASE_MEMORY_REF_COUNTED_MEMORY_H_
#pragma once
#include <vector>
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
// TODO(erg): The contents of this file should be in a namespace. This would
// require touching >100 files in chrome/ though.
@@ -79,4 +79,4 @@ class RefCountedBytes : public RefCountedMemory {
DISALLOW_COPY_AND_ASSIGN(RefCountedBytes);
};
-#endif // BASE_REF_COUNTED_MEMORY_H_
+#endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_
diff --git a/base/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc
index cd6f922..dcc292f 100644
--- a/base/ref_counted_unittest.cc
+++ b/base/memory/ref_counted_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
+#include "base/memory/ref_counted.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "base/ref_counted.h"
namespace {
diff --git a/base/scoped_callback_factory.h b/base/memory/scoped_callback_factory.h
index a2fc1f0..a9c58a0 100644
--- a/base/scoped_callback_factory.h
+++ b/base/memory/scoped_callback_factory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -33,11 +33,11 @@
// callback runs, it will notice that the MyClass instance is dead, and it will
// avoid calling the GotData method.
-#ifndef BASE_SCOPED_CALLBACK_FACTORY_H_
-#define BASE_SCOPED_CALLBACK_FACTORY_H_
+#ifndef BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_
+#define BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_
#include "base/callback.h"
-#include "base/weak_ptr.h"
+#include "base/memory/weak_ptr.h"
namespace base {
@@ -130,4 +130,4 @@ class ScopedCallbackFactory {
} // namespace base
-#endif // BASE_SCOPED_CALLBACK_FACTORY_H_
+#endif // BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_
diff --git a/base/scoped_handle.h b/base/memory/scoped_handle.h
index 90cb5d5..232d83e 100644
--- a/base/scoped_handle.h
+++ b/base/memory/scoped_handle.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_SCOPED_HANDLE_H_
-#define BASE_SCOPED_HANDLE_H_
+#ifndef BASE_MEMORY_SCOPED_HANDLE_H_
+#define BASE_MEMORY_SCOPED_HANDLE_H_
#pragma once
#include <stdio.h>
@@ -48,4 +48,4 @@ class ScopedStdioHandle {
DISALLOW_COPY_AND_ASSIGN(ScopedStdioHandle);
};
-#endif // BASE_SCOPED_HANDLE_H_
+#endif // BASE_MEMORY_SCOPED_HANDLE_H_
diff --git a/base/scoped_native_library.cc b/base/memory/scoped_native_library.cc
index 9d34449..c9aef45 100644
--- a/base/scoped_native_library.cc
+++ b/base/memory/scoped_native_library.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/scoped_native_library.h"
+#include "base/memory/scoped_native_library.h"
namespace base {
diff --git a/base/scoped_native_library.h b/base/memory/scoped_native_library.h
index 151bb5f..56116b9 100644
--- a/base/scoped_native_library.h
+++ b/base/memory/scoped_native_library.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_SCOPED_NATIVE_LIBRARY_H_
-#define BASE_SCOPED_NATIVE_LIBRARY_H_
+#ifndef BASE_MEMORY_SCOPED_NATIVE_LIBRARY_H_
+#define BASE_MEMORY_SCOPED_NATIVE_LIBRARY_H_
#pragma once
#include "base/base_api.h"
@@ -50,4 +50,4 @@ class BASE_API ScopedNativeLibrary {
} // namespace base
-#endif // BASE_SCOPED_NATIVE_LIBRARY_H_
+#endif // BASE_MEMORY_SCOPED_NATIVE_LIBRARY_H_
diff --git a/base/scoped_native_library_unittest.cc b/base/memory/scoped_native_library_unittest.cc
index 567239d..0cc60e2 100644
--- a/base/scoped_native_library_unittest.cc
+++ b/base/memory/scoped_native_library_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/scoped_native_library.h"
+#include "base/memory/scoped_native_library.h"
#if defined(OS_WIN)
#include "base/file_path.h"
#endif
diff --git a/base/scoped_nsobject.h b/base/memory/scoped_nsobject.h
index a9783e0..235ac39 100644
--- a/base/scoped_nsobject.h
+++ b/base/memory/scoped_nsobject.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 BASE_SCOPED_NSOBJECT_H_
-#define BASE_SCOPED_NSOBJECT_H_
+#ifndef BASE_MEMORY_SCOPED_NSOBJECT_H_
+#define BASE_MEMORY_SCOPED_NSOBJECT_H_
#pragma once
#import <Foundation/Foundation.h>
@@ -164,4 +164,4 @@ class scoped_nsobject<NSAutoreleasePool> {
DISALLOW_COPY_AND_ASSIGN(scoped_nsobject);
};
-#endif // BASE_SCOPED_NSOBJECT_H_
+#endif // BASE_MEMORY_SCOPED_NSOBJECT_H_
diff --git a/base/scoped_open_process.h b/base/memory/scoped_open_process.h
index 641f8e5..d5bdd95 100644
--- a/base/scoped_open_process.h
+++ b/base/memory/scoped_open_process.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 BASE_SCOPED_OPEN_PROCESS_H_
-#define BASE_SCOPED_OPEN_PROCESS_H_
+#ifndef BASE_MEMORY_SCOPED_OPEN_PROCESS_H_
+#define BASE_MEMORY_SCOPED_OPEN_PROCESS_H_
#pragma once
#include "base/process.h"
@@ -47,4 +47,4 @@ class ScopedOpenProcess {
};
} // namespace base
-#endif // BASE_SCOPED_OPEN_PROCESS_H_
+#endif // BASE_MEMORY_SCOPED_OPEN_PROCESS_H_
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
new file mode 100644
index 0000000..1067d42
--- /dev/null
+++ b/base/memory/scoped_ptr.h
@@ -0,0 +1,383 @@
+// Copyright (c) 2011 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.
+
+// Scopers help you manage ownership of a pointer, helping you easily manage the
+// a pointer within a scope, and automatically destroying the pointer at the
+// end of a scope. There are two main classes you will use, which correspond
+// to the operators new/delete and new[]/delete[].
+//
+// Example usage (scoped_ptr):
+// {
+// scoped_ptr<Foo> foo(new Foo("wee"));
+// } // foo goes out of scope, releasing the pointer with it.
+//
+// {
+// scoped_ptr<Foo> foo; // No pointer managed.
+// foo.reset(new Foo("wee")); // Now a pointer is managed.
+// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed.
+// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed.
+// foo->Method(); // Foo::Method() called.
+// foo.get()->Method(); // Foo::Method() called.
+// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer
+// // manages a pointer.
+// foo.reset(new Foo("wee4")); // foo manages a pointer again.
+// foo.reset(); // Foo("wee4") destroyed, foo no longer
+// // manages a pointer.
+// } // foo wasn't managing a pointer, so nothing was destroyed.
+//
+// Example usage (scoped_array):
+// {
+// scoped_array<Foo> foo(new Foo[100]);
+// foo.get()->Method(); // Foo::Method on the 0th element.
+// foo[10].Method(); // Foo::Method on the 10th element.
+// }
+
+#ifndef BASE_MEMORY_SCOPED_PTR_H_
+#define BASE_MEMORY_SCOPED_PTR_H_
+#pragma once
+
+// This is an implementation designed to match the anticipated future TR2
+// implementation of the scoped_ptr class, and its closely-related brethren,
+// scoped_array, scoped_ptr_malloc.
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "base/compiler_specific.h"
+
+// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
+// automatically deletes the pointer it holds (if any).
+// That is, scoped_ptr<T> owns the T object that it points to.
+// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
+// Also like T*, scoped_ptr<T> is thread-compatible, and once you
+// dereference it, you get the threadsafety guarantees of T.
+//
+// The size of a scoped_ptr is small:
+// sizeof(scoped_ptr<C>) == sizeof(C*)
+template <class C>
+class scoped_ptr {
+ public:
+
+ // The element type
+ typedef C element_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ // There is no way to create an uninitialized scoped_ptr.
+ // The input parameter must be allocated with new.
+ explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
+
+ // Destructor. If there is a C object, delete it.
+ // We don't need to test ptr_ == NULL because C++ does that for us.
+ ~scoped_ptr() {
+ enum { type_must_be_complete = sizeof(C) };
+ delete ptr_;
+ }
+
+ // Reset. Deletes the current owned object, if any.
+ // Then takes ownership of a new object, if given.
+ // this->reset(this->get()) works.
+ void reset(C* p = NULL) {
+ if (p != ptr_) {
+ enum { type_must_be_complete = sizeof(C) };
+ delete ptr_;
+ ptr_ = p;
+ }
+ }
+
+ // Accessors to get the owned object.
+ // operator* and operator-> will assert() if there is no current object.
+ C& operator*() const {
+ assert(ptr_ != NULL);
+ return *ptr_;
+ }
+ C* operator->() const {
+ assert(ptr_ != NULL);
+ return ptr_;
+ }
+ C* get() const { return ptr_; }
+
+ // Comparison operators.
+ // These return whether two scoped_ptr refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(C* p) const { return ptr_ == p; }
+ bool operator!=(C* p) const { return ptr_ != p; }
+
+ // Swap two scoped pointers.
+ void swap(scoped_ptr& p2) {
+ C* tmp = ptr_;
+ ptr_ = p2.ptr_;
+ p2.ptr_ = tmp;
+ }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ C* release() WARN_UNUSED_RESULT {
+ C* retVal = ptr_;
+ ptr_ = NULL;
+ return retVal;
+ }
+
+ private:
+ C* ptr_;
+
+ // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't
+ // make sense, and if C2 == C, it still doesn't make sense because you should
+ // never have the same object owned by two different scoped_ptrs.
+ template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
+ template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
+
+ // Disallow evil constructors
+ scoped_ptr(const scoped_ptr&);
+ void operator=(const scoped_ptr&);
+};
+
+// Free functions
+template <class C>
+void swap(scoped_ptr<C>& p1, scoped_ptr<C>& p2) {
+ p1.swap(p2);
+}
+
+template <class C>
+bool operator==(C* p1, const scoped_ptr<C>& p2) {
+ return p1 == p2.get();
+}
+
+template <class C>
+bool operator!=(C* p1, const scoped_ptr<C>& p2) {
+ return p1 != p2.get();
+}
+
+// scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
+// with new [] and the destructor deletes objects with delete [].
+//
+// As with scoped_ptr<C>, a scoped_array<C> either points to an object
+// or is NULL. A scoped_array<C> owns the object that it points to.
+// scoped_array<T> is thread-compatible, and once you index into it,
+// the returned objects have only the threadsafety guarantees of T.
+//
+// Size: sizeof(scoped_array<C>) == sizeof(C*)
+template <class C>
+class scoped_array {
+ public:
+
+ // The element type
+ typedef C element_type;
+
+ // Constructor. Defaults to intializing with NULL.
+ // There is no way to create an uninitialized scoped_array.
+ // The input parameter must be allocated with new [].
+ explicit scoped_array(C* p = NULL) : array_(p) { }
+
+ // Destructor. If there is a C object, delete it.
+ // We don't need to test ptr_ == NULL because C++ does that for us.
+ ~scoped_array() {
+ enum { type_must_be_complete = sizeof(C) };
+ delete[] array_;
+ }
+
+ // Reset. Deletes the current owned object, if any.
+ // Then takes ownership of a new object, if given.
+ // this->reset(this->get()) works.
+ void reset(C* p = NULL) {
+ if (p != array_) {
+ enum { type_must_be_complete = sizeof(C) };
+ delete[] array_;
+ array_ = p;
+ }
+ }
+
+ // Get one element of the current object.
+ // Will assert() if there is no current object, or index i is negative.
+ C& operator[](ptrdiff_t i) const {
+ assert(i >= 0);
+ assert(array_ != NULL);
+ return array_[i];
+ }
+
+ // Get a pointer to the zeroth element of the current object.
+ // If there is no current object, return NULL.
+ C* get() const {
+ return array_;
+ }
+
+ // Comparison operators.
+ // These return whether two scoped_array refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(C* p) const { return array_ == p; }
+ bool operator!=(C* p) const { return array_ != p; }
+
+ // Swap two scoped arrays.
+ void swap(scoped_array& p2) {
+ C* tmp = array_;
+ array_ = p2.array_;
+ p2.array_ = tmp;
+ }
+
+ // Release an array.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ C* release() WARN_UNUSED_RESULT {
+ C* retVal = array_;
+ array_ = NULL;
+ return retVal;
+ }
+
+ private:
+ C* array_;
+
+ // Forbid comparison of different scoped_array types.
+ template <class C2> bool operator==(scoped_array<C2> const& p2) const;
+ template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
+
+ // Disallow evil constructors
+ scoped_array(const scoped_array&);
+ void operator=(const scoped_array&);
+};
+
+// Free functions
+template <class C>
+void swap(scoped_array<C>& p1, scoped_array<C>& p2) {
+ p1.swap(p2);
+}
+
+template <class C>
+bool operator==(C* p1, const scoped_array<C>& p2) {
+ return p1 == p2.get();
+}
+
+template <class C>
+bool operator!=(C* p1, const scoped_array<C>& p2) {
+ return p1 != p2.get();
+}
+
+// This class wraps the c library function free() in a class that can be
+// passed as a template argument to scoped_ptr_malloc below.
+class ScopedPtrMallocFree {
+ public:
+ inline void operator()(void* x) const {
+ free(x);
+ }
+};
+
+// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
+// second template argument, the functor used to free the object.
+
+template<class C, class FreeProc = ScopedPtrMallocFree>
+class scoped_ptr_malloc {
+ public:
+
+ // The element type
+ typedef C element_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ // There is no way to create an uninitialized scoped_ptr.
+ // The input parameter must be allocated with an allocator that matches the
+ // Free functor. For the default Free functor, this is malloc, calloc, or
+ // realloc.
+ explicit scoped_ptr_malloc(C* p = NULL): ptr_(p) {}
+
+ // Destructor. If there is a C object, call the Free functor.
+ ~scoped_ptr_malloc() {
+ free_(ptr_);
+ }
+
+ // Reset. Calls the Free functor on the current owned object, if any.
+ // Then takes ownership of a new object, if given.
+ // this->reset(this->get()) works.
+ void reset(C* p = NULL) {
+ if (ptr_ != p) {
+ free_(ptr_);
+ ptr_ = p;
+ }
+ }
+
+ // Get the current object.
+ // operator* and operator-> will cause an assert() failure if there is
+ // no current object.
+ C& operator*() const {
+ assert(ptr_ != NULL);
+ return *ptr_;
+ }
+
+ C* operator->() const {
+ assert(ptr_ != NULL);
+ return ptr_;
+ }
+
+ C* get() const {
+ return ptr_;
+ }
+
+ // Comparison operators.
+ // These return whether a scoped_ptr_malloc and a plain pointer refer
+ // to the same object, not just to two different but equal objects.
+ // For compatibility with the boost-derived implementation, these
+ // take non-const arguments.
+ bool operator==(C* p) const {
+ return ptr_ == p;
+ }
+
+ bool operator!=(C* p) const {
+ return ptr_ != p;
+ }
+
+ // Swap two scoped pointers.
+ void swap(scoped_ptr_malloc & b) {
+ C* tmp = b.ptr_;
+ b.ptr_ = ptr_;
+ ptr_ = tmp;
+ }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ C* release() WARN_UNUSED_RESULT {
+ C* tmp = ptr_;
+ ptr_ = NULL;
+ return tmp;
+ }
+
+ private:
+ C* ptr_;
+
+ // no reason to use these: each scoped_ptr_malloc should have its own object
+ template <class C2, class GP>
+ bool operator==(scoped_ptr_malloc<C2, GP> const& p) const;
+ template <class C2, class GP>
+ bool operator!=(scoped_ptr_malloc<C2, GP> const& p) const;
+
+ static FreeProc const free_;
+
+ // Disallow evil constructors
+ scoped_ptr_malloc(const scoped_ptr_malloc&);
+ void operator=(const scoped_ptr_malloc&);
+};
+
+template<class C, class FP>
+FP const scoped_ptr_malloc<C, FP>::free_ = FP();
+
+template<class C, class FP> inline
+void swap(scoped_ptr_malloc<C, FP>& a, scoped_ptr_malloc<C, FP>& b) {
+ a.swap(b);
+}
+
+template<class C, class FP> inline
+bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) {
+ return p == b.get();
+}
+
+template<class C, class FP> inline
+bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
+ return p != b.get();
+}
+
+#endif // BASE_MEMORY_SCOPED_PTR_H_
diff --git a/base/scoped_ptr_unittest.cc b/base/memory/scoped_ptr_unittest.cc
index 99b1bc0..7519051 100644
--- a/base/scoped_ptr_unittest.cc
+++ b/base/memory/scoped_ptr_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
diff --git a/base/scoped_temp_dir.cc b/base/memory/scoped_temp_dir.cc
index 000ed0a..f7db15d 100644
--- a/base/scoped_temp_dir.cc
+++ b/base/memory/scoped_temp_dir.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/scoped_temp_dir.h"
+#include "base/memory/scoped_temp_dir.h"
#include "base/file_util.h"
#include "base/logging.h"
diff --git a/base/scoped_temp_dir.h b/base/memory/scoped_temp_dir.h
index d9f0e2f..4c0a73f 100644
--- a/base/scoped_temp_dir.h
+++ b/base/memory/scoped_temp_dir.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_SCOPED_TEMP_DIR_H_
-#define BASE_SCOPED_TEMP_DIR_H_
+#ifndef BASE_MEMORY_SCOPED_TEMP_DIR_H_
+#define BASE_MEMORY_SCOPED_TEMP_DIR_H_
#pragma once
// An object representing a temporary / scratch directory that should be cleaned
@@ -56,4 +56,4 @@ class BASE_API ScopedTempDir {
DISALLOW_COPY_AND_ASSIGN(ScopedTempDir);
};
-#endif // BASE_SCOPED_TEMP_DIR_H_
+#endif // BASE_MEMORY_SCOPED_TEMP_DIR_H_
diff --git a/base/scoped_temp_dir_unittest.cc b/base/memory/scoped_temp_dir_unittest.cc
index 135c2fd..a83856f 100644
--- a/base/scoped_temp_dir_unittest.cc
+++ b/base/memory/scoped_temp_dir_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/file_util.h"
+#include "base/memory/scoped_temp_dir.h"
#include "base/platform_file.h"
-#include "base/scoped_temp_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(ScopedTempDir, FullPath) {
diff --git a/base/scoped_vector.h b/base/memory/scoped_vector.h
index 9d372f3..aec4375 100644
--- a/base/scoped_vector.h
+++ b/base/memory/scoped_vector.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 BASE_SCOPED_VECTOR_H_
-#define BASE_SCOPED_VECTOR_H_
+#ifndef BASE_MEMORY_SCOPED_VECTOR_H_
+#define BASE_MEMORY_SCOPED_VECTOR_H_
#pragma once
#include <vector>
@@ -87,4 +87,4 @@ class ScopedVector {
DISALLOW_COPY_AND_ASSIGN(ScopedVector);
};
-#endif // BASE_SCOPED_VECTOR_H_
+#endif // BASE_MEMORY_SCOPED_VECTOR_H_
diff --git a/base/singleton.h b/base/memory/singleton.h
index 0fe5e27..a387356 100644
--- a/base/singleton.h
+++ b/base/memory/singleton.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 BASE_SINGLETON_H_
-#define BASE_SINGLETON_H_
+#ifndef BASE_MEMORY_SINGLETON_H_
+#define BASE_MEMORY_SINGLETON_H_
#pragma once
#include "base/at_exit.h"
@@ -126,7 +126,7 @@ template <typename Type> base::subtle::Atomic32
// Example usage:
//
// In your header:
-// #include "base/singleton.h"
+// #include "base/memory/singleton.h"
// class FooClass {
// public:
// static FooClass* GetInstance(); <-- See comment below on this.
@@ -268,4 +268,4 @@ template <typename Type, typename Traits, typename DifferentiatingType>
base::subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>::
instance_ = 0;
-#endif // BASE_SINGLETON_H_
+#endif // BASE_MEMORY_SINGLETON_H_
diff --git a/base/singleton_objc.h b/base/memory/singleton_objc.h
index e28c8a5..8531556 100644
--- a/base/singleton_objc.h
+++ b/base/memory/singleton_objc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -27,12 +27,12 @@
// ...
// Foo* widgetSingleton = SingletonObjC<Foo, FooSingletonTraits>::get();
-#ifndef BASE_SINGLETON_OBJC_H_
-#define BASE_SINGLETON_OBJC_H_
+#ifndef BASE_MEMORY_SINGLETON_OBJC_H_
+#define BASE_MEMORY_SINGLETON_OBJC_H_
#pragma once
#import <Foundation/Foundation.h>
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
// Singleton traits usable to manage traditional Objective-C objects, which
// are instantiated by sending |alloc| and |init| messages, and are deallocated
@@ -58,4 +58,4 @@ template<typename Type,
class SingletonObjC : public Singleton<Type, Traits, DifferentiatingType> {
};
-#endif // BASE_SINGLETON_OBJC_H_
+#endif // BASE_MEMORY_SINGLETON_OBJC_H_
diff --git a/base/singleton_unittest.cc b/base/memory/singleton_unittest.cc
index 3d7e7e6..a605885 100644
--- a/base/singleton_unittest.cc
+++ b/base/memory/singleton_unittest.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/at_exit.h"
#include "base/file_util.h"
+#include "base/memory/singleton.h"
#include "base/path_service.h"
-#include "base/singleton.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
diff --git a/base/weak_ptr.cc b/base/memory/weak_ptr.cc
index c9a6f48..fb09219 100644
--- a/base/weak_ptr.cc
+++ b/base/memory/weak_ptr.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/weak_ptr.h"
+#include "base/memory/weak_ptr.h"
namespace base {
namespace internal {
diff --git a/base/weak_ptr.h b/base/memory/weak_ptr.h
index 8862517..edb9d93 100644
--- a/base/weak_ptr.h
+++ b/base/memory/weak_ptr.h
@@ -48,13 +48,13 @@
// WARNING: weak pointers are not threadsafe!!! You must only use a WeakPtr
// instance on thread where it was created.
-#ifndef BASE_WEAK_PTR_H_
-#define BASE_WEAK_PTR_H_
+#ifndef BASE_MEMORY_WEAK_PTR_H_
+#define BASE_MEMORY_WEAK_PTR_H_
#pragma once
#include "base/base_api.h"
#include "base/logging.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/threading/non_thread_safe.h"
namespace base {
@@ -243,4 +243,4 @@ class WeakPtrFactory {
} // namespace base
-#endif // BASE_WEAK_PTR_H_
+#endif // BASE_MEMORY_WEAK_PTR_H_
diff --git a/base/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index bcaca9e..6c2a7e8 100644
--- a/base/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -1,12 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "base/message_loop.h"
#include "base/threading/thread.h"
-#include "base/scoped_ptr.h"
-#include "base/weak_ptr.h"
namespace base {
namespace {
diff --git a/base/message_loop.h b/base/message_loop.h
index fea7e39..7da04d3 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -11,9 +11,9 @@
#include "base/base_api.h"
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
-#include "base/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/task.h"
diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h
index 9ab0b8a..e750f2a 100644
--- a/base/message_loop_proxy.h
+++ b/base/message_loop_proxy.h
@@ -8,7 +8,7 @@
#include "base/base_api.h"
#include "base/basictypes.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/task.h"
namespace base {
diff --git a/base/message_loop_proxy_impl_unittest.cc b/base/message_loop_proxy_impl_unittest.cc
index 61c7850..558cd932 100644
--- a/base/message_loop_proxy_impl_unittest.cc
+++ b/base/message_loop_proxy_impl_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy_impl.h"
-#include "base/scoped_ptr.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index 2869bb8..cd681f3 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -6,8 +6,8 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
-#include "base/ref_counted.h"
#include "base/task.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
diff --git a/base/message_pump.h b/base/message_pump.h
index a356cf3..6a48e81 100644
--- a/base/message_pump.h
+++ b/base/message_pump.h
@@ -7,7 +7,7 @@
#pragma once
#include "base/base_api.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
namespace base {
diff --git a/base/message_pump_glib.h b/base/message_pump_glib.h
index 70bf108..7d7d8da 100644
--- a/base/message_pump_glib.h
+++ b/base/message_pump_glib.h
@@ -6,9 +6,9 @@
#define BASE_MESSAGE_PUMP_GLIB_H_
#pragma once
+#include "base/memory/scoped_ptr.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
-#include "base/scoped_ptr.h"
#include "base/time.h"
typedef union _GdkEvent GdkEvent;
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index fc604b9..496fda6 100644
--- a/base/message_pump_glib_unittest.cc
+++ b/base/message_pump_glib_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,8 +10,8 @@
#include <algorithm>
#include <vector>
+#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
-#include "base/ref_counted.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 28b4bfe..5154233 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -11,8 +11,8 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
-#include "base/scoped_ptr.h"
#include "base/time.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h
index 2ba31841..dcfd391 100644
--- a/base/metrics/field_trial.h
+++ b/base/metrics/field_trial.h
@@ -80,7 +80,7 @@
#include "base/base_api.h"
#include "base/gtest_prod_util.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/time.h"
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index aab39be..be375dff 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -38,8 +38,8 @@
#include "base/base_api.h"
#include "base/gtest_prod_util.h"
-#include "base/ref_counted.h"
#include "base/logging.h"
+#include "base/memory/ref_counted.h"
#include "base/time.h"
class Pickle;
diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc
index cfc1da1..3db008e 100644
--- a/base/metrics/stats_table.cc
+++ b/base/metrics/stats_table.cc
@@ -5,8 +5,8 @@
#include "base/metrics/stats_table.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/process_util.h"
-#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
#include "base/string_piece.h"
#include "base/string_util.h"
diff --git a/base/mime_util_xdg.cc b/base/mime_util_xdg.cc
index 4dd7a3e..387b69a 100644
--- a/base/mime_util_xdg.cc
+++ b/base/mime_util_xdg.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -15,9 +15,9 @@
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/message_loop.h"
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/third_party/xdg_mime/xdgmime.h"
diff --git a/base/nss_util.cc b/base/nss_util.cc
index 3229149..c78c6d5 100644
--- a/base/nss_util.cc
+++ b/base/nss_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -25,8 +25,8 @@
#include "base/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/native_library.h"
-#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index 47a662e..43c6913 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -12,9 +12,9 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/logging.h"
+#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/observer_list.h"
-#include "base/ref_counted.h"
#include "base/task.h"
///////////////////////////////////////////////////////////////////////////////
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 652d358..d313367 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,8 +7,8 @@
#include <vector>
+#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
-#include "base/ref_counted.h"
#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/openssl_util.cc b/base/openssl_util.cc
index 931485a..2c20f45 100644
--- a/base/openssl_util.cc
+++ b/base/openssl_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,8 +8,8 @@
#include <openssl/ssl.h>
#include "base/logging.h"
-#include "base/scoped_vector.h"
-#include "base/singleton.h"
+#include "base/memory/scoped_vector.h"
+#include "base/memory/singleton.h"
#include "base/string_piece.h"
#include "base/synchronization/lock.h"
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc
index 51330c7..07be5e3 100644
--- a/base/pickle_unittest.cc
+++ b/base/pickle_unittest.cc
@@ -1,12 +1,12 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include <string>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "base/pickle.h"
-#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/platform_file_unittest.cc b/base/platform_file_unittest.cc
index e54ab61..dac2956 100644
--- a/base/platform_file_unittest.cc
+++ b/base/platform_file_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/file_util.h"
+#include "base/memory/scoped_temp_dir.h"
#include "base/platform_file.h"
-#include "base/scoped_temp_dir.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 37b4eeb..6c7a9f6 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -23,8 +23,8 @@
#include "base/eintr_wrapper.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/process_util.h"
-#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 31e1dec..7082408 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,9 +10,9 @@
#include "base/eintr_wrapper.h"
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "base/scoped_ptr.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 71f0a1a9..895ec3b 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -15,8 +15,8 @@
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
-#include "base/scoped_ptr.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
diff --git a/base/process_win.cc b/base/process_win.cc
index cdb9390..2873d91 100644
--- a/base/process_win.cc
+++ b/base/process_win.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/process.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/process_util.h"
-#include "base/scoped_ptr.h"
namespace base {
diff --git a/base/ref_counted.h b/base/ref_counted.h
index a6ebfb7..5f23b29 100644
--- a/base/ref_counted.h
+++ b/base/ref_counted.h
@@ -6,294 +6,8 @@
#define BASE_REF_COUNTED_H_
#pragma once
-#include "base/atomic_ref_count.h"
-#include "base/base_api.h"
-#include "base/threading/thread_collision_warner.h"
-
-namespace base {
-
-namespace subtle {
-
-class BASE_API RefCountedBase {
- public:
- static bool ImplementsThreadSafeReferenceCounting() { return false; }
-
- bool HasOneRef() const { return ref_count_ == 1; }
-
- protected:
- RefCountedBase();
- ~RefCountedBase();
-
- void AddRef() const;
-
- // Returns true if the object should self-delete.
- bool Release() const;
-
- private:
- mutable int ref_count_;
-#ifndef NDEBUG
- mutable bool in_dtor_;
-#endif
-
- DFAKE_MUTEX(add_release_);
-
- DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
-};
-
-class BASE_API RefCountedThreadSafeBase {
- public:
- static bool ImplementsThreadSafeReferenceCounting() { return true; }
-
- bool HasOneRef() const;
-
- protected:
- RefCountedThreadSafeBase();
- ~RefCountedThreadSafeBase();
-
- void AddRef() const;
-
- // Returns true if the object should self-delete.
- bool Release() const;
-
- private:
- mutable AtomicRefCount ref_count_;
-#ifndef NDEBUG
- mutable bool in_dtor_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
-};
-
-} // namespace subtle
-
-//
-// A base class for reference counted classes. Otherwise, known as a cheap
-// knock-off of WebKit's RefCounted<T> class. To use this guy just extend your
-// class from it like so:
-//
-// class MyFoo : public base::RefCounted<MyFoo> {
-// ...
-// private:
-// friend class base::RefCounted<MyFoo>;
-// ~MyFoo();
-// };
-//
-// You should always make your destructor private, to avoid any code deleting
-// the object accidently while there are references to it.
-template <class T>
-class RefCounted : public subtle::RefCountedBase {
- public:
- RefCounted() { }
- ~RefCounted() { }
-
- void AddRef() const {
- subtle::RefCountedBase::AddRef();
- }
-
- void Release() const {
- if (subtle::RefCountedBase::Release()) {
- delete static_cast<const T*>(this);
- }
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RefCounted<T>);
-};
-
-// Forward declaration.
-template <class T, typename Traits> class RefCountedThreadSafe;
-
-// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
-// count reaches 0. Overload to delete it on a different thread etc.
-template<typename T>
-struct DefaultRefCountedThreadSafeTraits {
- static void Destruct(const T* x) {
- // Delete through RefCountedThreadSafe to make child classes only need to be
- // friend with RefCountedThreadSafe instead of this struct, which is an
- // implementation detail.
- RefCountedThreadSafe<T,
- DefaultRefCountedThreadSafeTraits>::DeleteInternal(x);
- }
-};
-
-//
-// A thread-safe variant of RefCounted<T>
-//
-// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
-// ...
-// };
-//
-// If you're using the default trait, then you should add compile time
-// asserts that no one else is deleting your object. i.e.
-// private:
-// friend class base::RefCountedThreadSafe<MyFoo>;
-// ~MyFoo();
-template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
-class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase {
- public:
- RefCountedThreadSafe() { }
- ~RefCountedThreadSafe() { }
-
- void AddRef() const {
- subtle::RefCountedThreadSafeBase::AddRef();
- }
-
- void Release() const {
- if (subtle::RefCountedThreadSafeBase::Release()) {
- Traits::Destruct(static_cast<const T*>(this));
- }
- }
-
- private:
- friend struct DefaultRefCountedThreadSafeTraits<T>;
- static void DeleteInternal(const T* x) { delete x; }
-
- DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
-};
-
-//
-// A wrapper for some piece of data so we can place other things in
-// scoped_refptrs<>.
-//
-template<typename T>
-class RefCountedData : public base::RefCounted< base::RefCountedData<T> > {
- public:
- RefCountedData() : data() {}
- RefCountedData(const T& in_value) : data(in_value) {}
-
- T data;
-};
-
-} // namespace base
-
-//
-// A smart pointer class for reference counted objects. Use this class instead
-// of calling AddRef and Release manually on a reference counted object to
-// avoid common memory leaks caused by forgetting to Release an object
-// reference. Sample usage:
-//
-// class MyFoo : public RefCounted<MyFoo> {
-// ...
-// };
-//
-// void some_function() {
-// scoped_refptr<MyFoo> foo = new MyFoo();
-// foo->Method(param);
-// // |foo| is released when this function returns
-// }
-//
-// void some_other_function() {
-// scoped_refptr<MyFoo> foo = new MyFoo();
-// ...
-// foo = NULL; // explicitly releases |foo|
-// ...
-// if (foo)
-// foo->Method(param);
-// }
-//
-// The above examples show how scoped_refptr<T> acts like a pointer to T.
-// Given two scoped_refptr<T> classes, it is also possible to exchange
-// references between the two objects, like so:
-//
-// {
-// scoped_refptr<MyFoo> a = new MyFoo();
-// scoped_refptr<MyFoo> b;
-//
-// b.swap(a);
-// // now, |b| references the MyFoo object, and |a| references NULL.
-// }
-//
-// To make both |a| and |b| in the above example reference the same MyFoo
-// object, simply use the assignment operator:
-//
-// {
-// scoped_refptr<MyFoo> a = new MyFoo();
-// scoped_refptr<MyFoo> b;
-//
-// b = a;
-// // now, |a| and |b| each own a reference to the same MyFoo object.
-// }
-//
-template <class T>
-class scoped_refptr {
- public:
- scoped_refptr() : ptr_(NULL) {
- }
-
- scoped_refptr(T* p) : ptr_(p) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- template <typename U>
- scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- ~scoped_refptr() {
- if (ptr_)
- ptr_->Release();
- }
-
- T* get() const { return ptr_; }
- operator T*() const { return ptr_; }
- T* operator->() const { return ptr_; }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- T* release() {
- T* retVal = ptr_;
- ptr_ = NULL;
- return retVal;
- }
-
- scoped_refptr<T>& operator=(T* p) {
- // AddRef first so that self assignment should work
- if (p)
- p->AddRef();
- if (ptr_ )
- ptr_ ->Release();
- ptr_ = p;
- return *this;
- }
-
- scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
- return *this = r.ptr_;
- }
-
- template <typename U>
- scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
- return *this = r.get();
- }
-
- void swap(T** pp) {
- T* p = ptr_;
- ptr_ = *pp;
- *pp = p;
- }
-
- void swap(scoped_refptr<T>& r) {
- swap(&r.ptr_);
- }
-
- protected:
- T* ptr_;
-};
-
-// Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
-// having to retype all the template arguments
-template <typename T>
-scoped_refptr<T> make_scoped_refptr(T* t) {
- return scoped_refptr<T>(t);
-}
+// FIXME: Remove this header when third_party/leveldb is fixed to not rely on
+// it.
+#include "base/memory/ref_counted.h"
#endif // BASE_REF_COUNTED_H_
diff --git a/base/scoped_ptr.h b/base/scoped_ptr.h
index 0a90150a..f36da51 100644
--- a/base/scoped_ptr.h
+++ b/base/scoped_ptr.h
@@ -1,383 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-// Scopers help you manage ownership of a pointer, helping you easily manage the
-// a pointer within a scope, and automatically destroying the pointer at the
-// end of a scope. There are two main classes you will use, which correspond
-// to the operators new/delete and new[]/delete[].
-//
-// Example usage (scoped_ptr):
-// {
-// scoped_ptr<Foo> foo(new Foo("wee"));
-// } // foo goes out of scope, releasing the pointer with it.
-//
-// {
-// scoped_ptr<Foo> foo; // No pointer managed.
-// foo.reset(new Foo("wee")); // Now a pointer is managed.
-// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed.
-// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed.
-// foo->Method(); // Foo::Method() called.
-// foo.get()->Method(); // Foo::Method() called.
-// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer
-// // manages a pointer.
-// foo.reset(new Foo("wee4")); // foo manages a pointer again.
-// foo.reset(); // Foo("wee4") destroyed, foo no longer
-// // manages a pointer.
-// } // foo wasn't managing a pointer, so nothing was destroyed.
-//
-// Example usage (scoped_array):
-// {
-// scoped_array<Foo> foo(new Foo[100]);
-// foo.get()->Method(); // Foo::Method on the 0th element.
-// foo[10].Method(); // Foo::Method on the 10th element.
-// }
-
#ifndef BASE_SCOPED_PTR_H_
#define BASE_SCOPED_PTR_H_
#pragma once
-// This is an implementation designed to match the anticipated future TR2
-// implementation of the scoped_ptr class, and its closely-related brethren,
-// scoped_array, scoped_ptr_malloc.
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "base/compiler_specific.h"
-
-// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
-// automatically deletes the pointer it holds (if any).
-// That is, scoped_ptr<T> owns the T object that it points to.
-// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
-// Also like T*, scoped_ptr<T> is thread-compatible, and once you
-// dereference it, you get the threadsafety guarantees of T.
-//
-// The size of a scoped_ptr is small:
-// sizeof(scoped_ptr<C>) == sizeof(C*)
-template <class C>
-class scoped_ptr {
- public:
-
- // The element type
- typedef C element_type;
-
- // Constructor. Defaults to initializing with NULL.
- // There is no way to create an uninitialized scoped_ptr.
- // The input parameter must be allocated with new.
- explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
-
- // Destructor. If there is a C object, delete it.
- // We don't need to test ptr_ == NULL because C++ does that for us.
- ~scoped_ptr() {
- enum { type_must_be_complete = sizeof(C) };
- delete ptr_;
- }
-
- // Reset. Deletes the current owned object, if any.
- // Then takes ownership of a new object, if given.
- // this->reset(this->get()) works.
- void reset(C* p = NULL) {
- if (p != ptr_) {
- enum { type_must_be_complete = sizeof(C) };
- delete ptr_;
- ptr_ = p;
- }
- }
-
- // Accessors to get the owned object.
- // operator* and operator-> will assert() if there is no current object.
- C& operator*() const {
- assert(ptr_ != NULL);
- return *ptr_;
- }
- C* operator->() const {
- assert(ptr_ != NULL);
- return ptr_;
- }
- C* get() const { return ptr_; }
-
- // Comparison operators.
- // These return whether two scoped_ptr refer to the same object, not just to
- // two different but equal objects.
- bool operator==(C* p) const { return ptr_ == p; }
- bool operator!=(C* p) const { return ptr_ != p; }
-
- // Swap two scoped pointers.
- void swap(scoped_ptr& p2) {
- C* tmp = ptr_;
- ptr_ = p2.ptr_;
- p2.ptr_ = tmp;
- }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- C* release() WARN_UNUSED_RESULT {
- C* retVal = ptr_;
- ptr_ = NULL;
- return retVal;
- }
-
- private:
- C* ptr_;
-
- // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't
- // make sense, and if C2 == C, it still doesn't make sense because you should
- // never have the same object owned by two different scoped_ptrs.
- template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
- template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
-
- // Disallow evil constructors
- scoped_ptr(const scoped_ptr&);
- void operator=(const scoped_ptr&);
-};
-
-// Free functions
-template <class C>
-void swap(scoped_ptr<C>& p1, scoped_ptr<C>& p2) {
- p1.swap(p2);
-}
-
-template <class C>
-bool operator==(C* p1, const scoped_ptr<C>& p2) {
- return p1 == p2.get();
-}
-
-template <class C>
-bool operator!=(C* p1, const scoped_ptr<C>& p2) {
- return p1 != p2.get();
-}
-
-// scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
-// with new [] and the destructor deletes objects with delete [].
-//
-// As with scoped_ptr<C>, a scoped_array<C> either points to an object
-// or is NULL. A scoped_array<C> owns the object that it points to.
-// scoped_array<T> is thread-compatible, and once you index into it,
-// the returned objects have only the threadsafety guarantees of T.
-//
-// Size: sizeof(scoped_array<C>) == sizeof(C*)
-template <class C>
-class scoped_array {
- public:
-
- // The element type
- typedef C element_type;
-
- // Constructor. Defaults to intializing with NULL.
- // There is no way to create an uninitialized scoped_array.
- // The input parameter must be allocated with new [].
- explicit scoped_array(C* p = NULL) : array_(p) { }
-
- // Destructor. If there is a C object, delete it.
- // We don't need to test ptr_ == NULL because C++ does that for us.
- ~scoped_array() {
- enum { type_must_be_complete = sizeof(C) };
- delete[] array_;
- }
-
- // Reset. Deletes the current owned object, if any.
- // Then takes ownership of a new object, if given.
- // this->reset(this->get()) works.
- void reset(C* p = NULL) {
- if (p != array_) {
- enum { type_must_be_complete = sizeof(C) };
- delete[] array_;
- array_ = p;
- }
- }
-
- // Get one element of the current object.
- // Will assert() if there is no current object, or index i is negative.
- C& operator[](ptrdiff_t i) const {
- assert(i >= 0);
- assert(array_ != NULL);
- return array_[i];
- }
-
- // Get a pointer to the zeroth element of the current object.
- // If there is no current object, return NULL.
- C* get() const {
- return array_;
- }
-
- // Comparison operators.
- // These return whether two scoped_array refer to the same object, not just to
- // two different but equal objects.
- bool operator==(C* p) const { return array_ == p; }
- bool operator!=(C* p) const { return array_ != p; }
-
- // Swap two scoped arrays.
- void swap(scoped_array& p2) {
- C* tmp = array_;
- array_ = p2.array_;
- p2.array_ = tmp;
- }
-
- // Release an array.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- C* release() WARN_UNUSED_RESULT {
- C* retVal = array_;
- array_ = NULL;
- return retVal;
- }
-
- private:
- C* array_;
-
- // Forbid comparison of different scoped_array types.
- template <class C2> bool operator==(scoped_array<C2> const& p2) const;
- template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
-
- // Disallow evil constructors
- scoped_array(const scoped_array&);
- void operator=(const scoped_array&);
-};
-
-// Free functions
-template <class C>
-void swap(scoped_array<C>& p1, scoped_array<C>& p2) {
- p1.swap(p2);
-}
-
-template <class C>
-bool operator==(C* p1, const scoped_array<C>& p2) {
- return p1 == p2.get();
-}
-
-template <class C>
-bool operator!=(C* p1, const scoped_array<C>& p2) {
- return p1 != p2.get();
-}
-
-// This class wraps the c library function free() in a class that can be
-// passed as a template argument to scoped_ptr_malloc below.
-class ScopedPtrMallocFree {
- public:
- inline void operator()(void* x) const {
- free(x);
- }
-};
-
-// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
-// second template argument, the functor used to free the object.
-
-template<class C, class FreeProc = ScopedPtrMallocFree>
-class scoped_ptr_malloc {
- public:
-
- // The element type
- typedef C element_type;
-
- // Constructor. Defaults to initializing with NULL.
- // There is no way to create an uninitialized scoped_ptr.
- // The input parameter must be allocated with an allocator that matches the
- // Free functor. For the default Free functor, this is malloc, calloc, or
- // realloc.
- explicit scoped_ptr_malloc(C* p = NULL): ptr_(p) {}
-
- // Destructor. If there is a C object, call the Free functor.
- ~scoped_ptr_malloc() {
- free_(ptr_);
- }
-
- // Reset. Calls the Free functor on the current owned object, if any.
- // Then takes ownership of a new object, if given.
- // this->reset(this->get()) works.
- void reset(C* p = NULL) {
- if (ptr_ != p) {
- free_(ptr_);
- ptr_ = p;
- }
- }
-
- // Get the current object.
- // operator* and operator-> will cause an assert() failure if there is
- // no current object.
- C& operator*() const {
- assert(ptr_ != NULL);
- return *ptr_;
- }
-
- C* operator->() const {
- assert(ptr_ != NULL);
- return ptr_;
- }
-
- C* get() const {
- return ptr_;
- }
-
- // Comparison operators.
- // These return whether a scoped_ptr_malloc and a plain pointer refer
- // to the same object, not just to two different but equal objects.
- // For compatibility with the boost-derived implementation, these
- // take non-const arguments.
- bool operator==(C* p) const {
- return ptr_ == p;
- }
-
- bool operator!=(C* p) const {
- return ptr_ != p;
- }
-
- // Swap two scoped pointers.
- void swap(scoped_ptr_malloc & b) {
- C* tmp = b.ptr_;
- b.ptr_ = ptr_;
- ptr_ = tmp;
- }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- C* release() WARN_UNUSED_RESULT {
- C* tmp = ptr_;
- ptr_ = NULL;
- return tmp;
- }
-
- private:
- C* ptr_;
-
- // no reason to use these: each scoped_ptr_malloc should have its own object
- template <class C2, class GP>
- bool operator==(scoped_ptr_malloc<C2, GP> const& p) const;
- template <class C2, class GP>
- bool operator!=(scoped_ptr_malloc<C2, GP> const& p) const;
-
- static FreeProc const free_;
-
- // Disallow evil constructors
- scoped_ptr_malloc(const scoped_ptr_malloc&);
- void operator=(const scoped_ptr_malloc&);
-};
-
-template<class C, class FP>
-FP const scoped_ptr_malloc<C, FP>::free_ = FP();
-
-template<class C, class FP> inline
-void swap(scoped_ptr_malloc<C, FP>& a, scoped_ptr_malloc<C, FP>& b) {
- a.swap(b);
-}
-
-template<class C, class FP> inline
-bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) {
- return p == b.get();
-}
-
-template<class C, class FP> inline
-bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
- return p != b.get();
-}
+// FIXME: Remove this header when third_party/cacheinvalidation is fixed to not
+// rely on it.
+#include "base/memory/scoped_ptr.h"
#endif // BASE_SCOPED_PTR_H_
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index b515e79..edcbb50 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/basictypes.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/memory/scoped_ptr.h"
#include "base/shared_memory.h"
-#include "base/scoped_ptr.h"
#include "base/test/multiprocess_test.h"
#include "base/threading/platform_thread.h"
#include "base/time.h"
diff --git a/base/stack_container_unittest.cc b/base/stack_container_unittest.cc
index e1392c1..816ee07 100644
--- a/base/stack_container_unittest.cc
+++ b/base/stack_container_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,8 +6,8 @@
#include <algorithm>
+#include "base/memory/ref_counted.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "base/ref_counted.h"
namespace {
diff --git a/base/string_util.cc b/base/string_util.cc
index af96d91..1ad9abe 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -22,7 +22,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/third_party/dmg_fp/dmg_fp.h"
#include "base/utf_string_conversion_utils.h"
#include "base/utf_string_conversions.h"
diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc
index cf18320..808ecde 100644
--- a/base/synchronization/condition_variable_unittest.cc
+++ b/base/synchronization/condition_variable_unittest.cc
@@ -9,7 +9,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/spin_wait.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
diff --git a/base/synchronization/waitable_event.h b/base/synchronization/waitable_event.h
index fe14e23..1ab20fa 100644
--- a/base/synchronization/waitable_event.h
+++ b/base/synchronization/waitable_event.h
@@ -16,7 +16,7 @@
#if defined(OS_POSIX)
#include <list>
#include <utility>
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#endif
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index 83e099c..ce8376a 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -8,7 +8,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/stringprintf.h"
namespace base {
diff --git a/base/task.h b/base/task.h
index 7fd5b52..8030169 100644
--- a/base/task.h
+++ b/base/task.h
@@ -7,10 +7,10 @@
#pragma once
#include "base/base_api.h"
-#include "base/raw_scoped_refptr_mismatch_checker.h"
+#include "base/memory/raw_scoped_refptr_mismatch_checker.h"
+#include "base/memory/weak_ptr.h"
#include "base/tracked.h"
#include "base/tuple.h"
-#include "base/weak_ptr.h"
// Task ------------------------------------------------------------------------
//
diff --git a/base/task_queue_unittest.cc b/base/task_queue_unittest.cc
index 90fc4cd..f2d2f49 100644
--- a/base/task_queue_unittest.cc
+++ b/base/task_queue_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/task.h"
#include "base/task_queue.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/task_unittest.cc b/base/task_unittest.cc
index cc975e0..25c201d 100644
--- a/base/task_unittest.cc
+++ b/base/task_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/task.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 42b5b90..aadd5e1 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -14,10 +14,10 @@
#include "base/i18n/icu_util.h"
#include "base/logging.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/memory/scoped_ptr.h"
#include "base/nss_util.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "base/scoped_ptr.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "base/time.h"
diff --git a/base/threading/non_thread_safe_unittest.cc b/base/threading/non_thread_safe_unittest.cc
index b79a4f4..01efe28 100644
--- a/base/threading/non_thread_safe_unittest.cc
+++ b/base/threading/non_thread_safe_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 103145a..e880222 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,8 +8,8 @@
#include <sched.h>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
#include "base/threading/thread_restrictions.h"
#if defined(OS_MACOSX)
diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
index 9a22a8e..2808048 100644
--- a/base/threading/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/threading/thread_collision_warner_unittest.cc b/base/threading/thread_collision_warner_unittest.cc
index a3d3b66..4613955 100644
--- a/base/threading/thread_collision_warner_unittest.cc
+++ b/base/threading/thread_collision_warner_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include "base/compiler_specific.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 8466403..bd6210f 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,7 +6,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "base/stringprintf.h"
#include "base/task.h"
#include "base/threading/platform_thread.h"
diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h
index 1b68aef..701157a 100644
--- a/base/threading/worker_pool_posix.h
+++ b/base/threading/worker_pool_posix.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
//
@@ -29,8 +29,8 @@
#include <string>
#include "base/basictypes.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
diff --git a/base/time_win.cc b/base/time_win.cc
index 601211c..883c486 100644
--- a/base/time_win.cc
+++ b/base/time_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -43,7 +43,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/cpu.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
using base::Time;
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc
index c2289c8..79d3a4e 100644
--- a/base/timer_unittest.cc
+++ b/base/timer_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
-#include "base/scoped_ptr.h"
#include "base/task.h"
#include "base/timer.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 5f901b5..809fe90 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
#include <limits>
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/base/version_unittest.cc b/base/version_unittest.cc
index 2e3c2ca..486ef7d 100644
--- a/base/version_unittest.cc
+++ b/base/version_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/version.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/win/scoped_comptr.h b/base/win/scoped_comptr.h
index e508ef2..9a4dd9d 100644
--- a/base/win/scoped_comptr.h
+++ b/base/win/scoped_comptr.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,7 +9,7 @@
#include <unknwn.h>
#include "base/logging.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
namespace base {
namespace win {
diff --git a/base/win/scoped_comptr_unittest.cc b/base/win/scoped_comptr_unittest.cc
index fcd0791..54dcfc0 100644
--- a/base/win/scoped_comptr_unittest.cc
+++ b/base/win/scoped_comptr_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,7 +6,7 @@
#include <shlobj.h>
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -110,4 +110,4 @@ TEST(ScopedComPtrTest, ScopedComPtrVector) {
}
} // namespace win
-} // namespace base \ No newline at end of file
+} // namespace base
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 76d8c5d..8a9d622 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -12,8 +12,8 @@
#include <shlobj.h>
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/win/registry.h"
-#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"