diff options
author | dcheng <dcheng@chromium.org> | 2015-11-18 23:00:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-19 07:01:23 +0000 |
commit | 0917ec4328dc20b59887d78f76b9f075e12e5f7f (patch) | |
tree | e2e24def30f3b6619eb1b92d570b055bfcef9672 | |
parent | d076ca806251e4b636b421eb46ca04d14366b2cc (diff) | |
download | chromium_src-0917ec4328dc20b59887d78f76b9f075e12e5f7f.zip chromium_src-0917ec4328dc20b59887d78f76b9f075e12e5f7f.tar.gz chromium_src-0917ec4328dc20b59887d78f76b9f075e12e5f7f.tar.bz2 |
Use std::default_delete as the default deleter for scoped_ptr.
The aim is to make scoped_ptr and std::unique_ptr functionally
identical so scoped_ptr can simply be a typedef.
BUG=554298
Review URL: https://codereview.chromium.org/1445003002
Cr-Commit-Position: refs/heads/master@{#360539}
76 files changed, 219 insertions, 285 deletions
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h index 291d9b3..869bdfd 100644 --- a/base/memory/scoped_ptr.h +++ b/base/memory/scoped_ptr.h @@ -84,8 +84,9 @@ #include <stddef.h> #include <stdlib.h> -#include <algorithm> // For std::swap(). #include <iosfwd> +#include <memory> +#include <utility> #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -99,61 +100,6 @@ class RefCountedBase; class RefCountedThreadSafeBase; } // namespace subtle -// Function object which deletes its parameter, which must be a pointer. -// If C is an array type, invokes 'delete[]' on the parameter; otherwise, -// invokes 'delete'. The default deleter for scoped_ptr<T>. -template <class T> -struct DefaultDeleter { - DefaultDeleter() {} - template <typename U> DefaultDeleter(const DefaultDeleter<U>& other) { - // IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor - // if U* is implicitly convertible to T* and U is not an array type. - // - // Correct implementation should use SFINAE to disable this - // constructor. However, since there are no other 1-argument constructors, - // using a COMPILE_ASSERT() based on is_convertible<> and requiring - // complete types is simpler and will cause compile failures for equivalent - // misuses. - // - // Note, the is_convertible<U*, T*> check also ensures that U is not an - // array. T is guaranteed to be a non-array, so any U* where U is an array - // cannot convert to T*. - enum { T_must_be_complete = sizeof(T) }; - enum { U_must_be_complete = sizeof(U) }; - COMPILE_ASSERT((base::is_convertible<U*, T*>::value), - U_ptr_must_implicitly_convert_to_T_ptr); - } - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete ptr; - } -}; - -// Specialization of DefaultDeleter for array types. -template <class T> -struct DefaultDeleter<T[]> { - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete[] ptr; - } - - private: - // Disable this operator for any U != T because it is undefined to execute - // an array delete when the static type of the array mismatches the dynamic - // type. - // - // References: - // C++98 [expr.delete]p3 - // http://cplusplus.github.com/LWG/lwg-defects.html#938 - template <typename U> void operator()(U* array) const; -}; - -template <class T, int n> -struct DefaultDeleter<T[n]> { - // Never allow someone to declare something like scoped_ptr<int[10]>. - COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type); -}; - // Function object which invokes 'free' on its parameter, which must be // a pointer. Can be used to store malloc-allocated pointers in scoped_ptr: // @@ -175,17 +121,6 @@ template <typename T> struct IsNotRefCounted { }; }; -template <typename T> -struct ShouldAbortOnSelfReset { - template <typename U> - static NoType Test(const typename U::AllowSelfReset*); - - template <typename U> - static YesType Test(...); - - static const bool value = sizeof(Test<T>(0)) == sizeof(YesType); -}; - // Minimal implementation of the core logic of scoped_ptr, suitable for // reuse in both scoped_ptr and its specializations. template <class T, class D> @@ -230,10 +165,6 @@ class scoped_ptr_impl { } void reset(T* p) { - // This is a self-reset, which is no longer allowed for default deleters: - // https://crbug.com/162971 - assert(!ShouldAbortOnSelfReset<D>::value || p == nullptr || p != data_.ptr); - // Match C++11's definition of unique_ptr::reset(), which requires changing // the pointer before invoking the deleter on the old pointer. This prevents // |this| from being accessed after the deleter is run, which may destroy @@ -295,15 +226,15 @@ class scoped_ptr_impl { // dereference it, you get the thread safety guarantees of T. // // The size of scoped_ptr is small. On most compilers, when using the -// DefaultDeleter, sizeof(scoped_ptr<T>) == sizeof(T*). Custom deleters will -// increase the size proportional to whatever state they need to have. See +// std::default_delete, sizeof(scoped_ptr<T>) == sizeof(T*). Custom deleters +// will increase the size proportional to whatever state they need to have. See // comments inside scoped_ptr_impl<> for details. // // Current implementation targets having a strict subset of C++11's // unique_ptr<> features. Known deficiencies include not supporting move-only // deleteres, function pointers as deleters, and deleters with reference // types. -template <class T, class D = base::DefaultDeleter<T> > +template <class T, class D = std::default_delete<T>> class scoped_ptr { MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(scoped_ptr) diff --git a/base/memory/scoped_ptr_unittest.cc b/base/memory/scoped_ptr_unittest.cc index ad49f4f..6330bb9 100644 --- a/base/memory/scoped_ptr_unittest.cc +++ b/base/memory/scoped_ptr_unittest.cc @@ -641,46 +641,6 @@ TEST(ScopedPtrTest, Conversion) { super2 = SubClassReturn(); } -// Android death tests don't work properly with assert(). Yay. -#if !defined(NDEBUG) && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) -TEST(ScopedPtrTest, SelfResetAbortsWithDefaultDeleter) { - scoped_ptr<int> x(new int); - EXPECT_DEATH(x.reset(x.get()), ""); -} - -TEST(ScopedPtrTest, SelfResetAbortsWithDefaultArrayDeleter) { - scoped_ptr<int[]> y(new int[4]); - EXPECT_DEATH(y.reset(y.get()), ""); -} - -TEST(ScopedPtrTest, SelfResetAbortsWithDefaultFreeDeleter) { - scoped_ptr<int, base::FreeDeleter> z(static_cast<int*>(malloc(sizeof(int)))); - EXPECT_DEATH(z.reset(z.get()), ""); -} - -// A custom deleter that doesn't opt out should still crash. -TEST(ScopedPtrTest, SelfResetAbortsWithCustomDeleter) { - struct CustomDeleter { - inline void operator()(int* x) { delete x; } - }; - scoped_ptr<int, CustomDeleter> x(new int); - EXPECT_DEATH(x.reset(x.get()), ""); -} -#endif - -TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) { - // A custom deleter should be able to opt out of self-reset abort behavior. - struct NoOpDeleter { -#if !defined(NDEBUG) - typedef void AllowSelfReset; -#endif - inline void operator()(int*) {} - }; - scoped_ptr<int> owner(new int); - scoped_ptr<int, NoOpDeleter> x(owner.get()); - x.reset(x.get()); -} - // Logging a scoped_ptr<T> to an ostream shouldn't convert it to a boolean // value first. TEST(ScopedPtrTest, LoggingDoesntConvertToBoolean) { diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc index c3b3e50..63b7d96 100644 --- a/base/process/process_metrics_win.cc +++ b/base/process/process_metrics_win.cc @@ -8,6 +8,8 @@ #include <psapi.h> #include <winternl.h> +#include <algorithm> + #include "base/logging.h" #include "base/sys_info.h" diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h index 7f0508b..3102713 100644 --- a/base/trace_event/memory_dump_manager.h +++ b/base/trace_event/memory_dump_manager.h @@ -5,6 +5,7 @@ #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ +#include <memory> #include <set> #include "base/atomicops.h" @@ -124,7 +125,7 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver { } private: - friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. + friend std::default_delete<MemoryDumpManager>; // For the testing instance. friend struct DefaultSingletonTraits<MemoryDumpManager>; friend class MemoryDumpManagerDelegate; friend class MemoryDumpManagerTest; diff --git a/chrome/app/close_handle_hook_win.cc b/chrome/app/close_handle_hook_win.cc index efec307..a0dc2f4 100644 --- a/chrome/app/close_handle_hook_win.cc +++ b/chrome/app/close_handle_hook_win.cc @@ -7,6 +7,7 @@ #include <Windows.h> #include <psapi.h> +#include <algorithm> #include <vector> #include "base/lazy_instance.h" diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_manager.h b/chrome/browser/chromeos/app_mode/kiosk_app_manager.h index 13d8da3..c2b46b0 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_manager.h +++ b/chrome/browser/chromeos/app_mode/kiosk_app_manager.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ +#include <memory> #include <string> #include <vector> @@ -228,7 +229,7 @@ class KioskAppManager : public KioskAppDataDelegate, private: friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; - friend struct base::DefaultDeleter<KioskAppManager>; + friend std::default_delete<KioskAppManager>; friend class KioskAppManagerTest; friend class KioskTest; friend class KioskUpdateTest; diff --git a/chrome/browser/devtools/devtools_network_interceptor.cc b/chrome/browser/devtools/devtools_network_interceptor.cc index a30baaf..005ebd4 100644 --- a/chrome/browser/devtools/devtools_network_interceptor.cc +++ b/chrome/browser/devtools/devtools_network_interceptor.cc @@ -4,6 +4,7 @@ #include "chrome/browser/devtools/devtools_network_interceptor.h" +#include <algorithm> #include <limits> #include "base/time/time.h" diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc index d56ed0c..75f104b 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc @@ -121,11 +121,9 @@ void WebrtcAudioPrivateFunction::GetOutputDeviceNames() { AudioManager::Get()->GetAudioOutputDeviceNames(device_names.get()); BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, - base::Bind(&WebrtcAudioPrivateFunction::OnOutputDeviceNames, - this, - Passed(&device_names))); + BrowserThread::IO, FROM_HERE, + base::Bind(&WebrtcAudioPrivateFunction::OnOutputDeviceNames, this, + base::Passed(&device_names))); } void WebrtcAudioPrivateFunction::OnOutputDeviceNames( diff --git a/chrome/browser/media/webrtc_log_uploader.cc b/chrome/browser/media/webrtc_log_uploader.cc index ef55b43..a726791 100644 --- a/chrome/browser/media/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc_log_uploader.cc @@ -197,12 +197,10 @@ void WebRtcLogUploader::UploadCompressedLog( } content::BrowserThread::PostTask( - content::BrowserThread::UI, - FROM_HERE, + content::BrowserThread::UI, FROM_HERE, base::Bind(&WebRtcLogUploader::CreateAndStartURLFetcher, - base::Unretained(this), - upload_done_data, - Passed(&post_data))); + base::Unretained(this), upload_done_data, + base::Passed(&post_data))); content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&WebRtcLogUploader::DecreaseLogCount, base::Unretained(this))); diff --git a/chrome/browser/media/webrtc_logging_handler_host.cc b/chrome/browser/media/webrtc_logging_handler_host.cc index ef42d74..25cb76e 100644 --- a/chrome/browser/media/webrtc_logging_handler_host.cc +++ b/chrome/browser/media/webrtc_logging_handler_host.cc @@ -312,12 +312,11 @@ void WebRtcLoggingHandlerHost::StoreLogContinue( ReleaseRtpDumps(log_paths.get()); content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::FILE, - FROM_HERE, + content::BrowserThread::FILE, FROM_HERE, base::Bind(&WebRtcLoggingHandlerHost::GetLogDirectoryAndEnsureExists, this), base::Bind(&WebRtcLoggingHandlerHost::StoreLogInDirectory, this, log_id, - Passed(&log_paths), callback)); + base::Passed(&log_paths), callback)); } void WebRtcLoggingHandlerHost::LogMessage(const std::string& message) { @@ -679,11 +678,12 @@ void WebRtcLoggingHandlerHost::StoreLogInDirectory( log_paths->log_path = directory; log_buffer_->SetComplete(); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, base::Bind(&WebRtcLogUploader::LoggingStoppedDoStore, - base::Unretained(g_browser_process->webrtc_log_uploader()), - *log_paths.get(), log_id, Passed(&log_buffer_), Passed(&meta_data_), - done_callback)); + base::Unretained(g_browser_process->webrtc_log_uploader()), + *log_paths.get(), log_id, base::Passed(&log_buffer_), + base::Passed(&meta_data_), done_callback)); logging_state_ = CLOSED; } @@ -700,12 +700,12 @@ void WebRtcLoggingHandlerHost::DoUploadLogAndRtpDumps( ReleaseRtpDumps(&upload_done_data); log_buffer_->SetComplete(); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( - &WebRtcLogUploader::LoggingStoppedDoUpload, - base::Unretained(g_browser_process->webrtc_log_uploader()), - Passed(&log_buffer_), - Passed(&meta_data_), - upload_done_data)); + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, + base::Bind(&WebRtcLogUploader::LoggingStoppedDoUpload, + base::Unretained(g_browser_process->webrtc_log_uploader()), + base::Passed(&log_buffer_), base::Passed(&meta_data_), + upload_done_data)); logging_state_ = CLOSED; } diff --git a/chrome/browser/media/webrtc_rtp_dump_writer.cc b/chrome/browser/media/webrtc_rtp_dump_writer.cc index e397da0..2ad3f4f 100644 --- a/chrome/browser/media/webrtc_rtp_dump_writer.cc +++ b/chrome/browser/media/webrtc_rtp_dump_writer.cc @@ -377,19 +377,14 @@ void WebRtcRtpDumpWriter::FlushBuffer(bool incoming, // guaranteed to be deleted on the FILE thread before this object goes away. base::Closure task = base::Bind(&FileThreadWorker::CompressAndWriteToFileOnFileThread, - base::Unretained(worker), - Passed(&new_buffer), - end_stream, - result.get(), - bytes_written.get()); + base::Unretained(worker), base::Passed(&new_buffer), + end_stream, result.get(), bytes_written.get()); // OnFlushDone is necessary to avoid running the callback after this // object is gone. - base::Closure reply = base::Bind(&WebRtcRtpDumpWriter::OnFlushDone, - weak_ptr_factory_.GetWeakPtr(), - callback, - Passed(&result), - Passed(&bytes_written)); + base::Closure reply = base::Bind( + &WebRtcRtpDumpWriter::OnFlushDone, weak_ptr_factory_.GetWeakPtr(), + callback, base::Passed(&result), base::Passed(&bytes_written)); // Define the task and reply outside the method call so that getting and // passing the scoped_ptr does not depend on the argument evaluation order. diff --git a/chrome/browser/metrics/time_ticks_experiment_win.cc b/chrome/browser/metrics/time_ticks_experiment_win.cc index c403dfd..8cc27f0 100644 --- a/chrome/browser/metrics/time_ticks_experiment_win.cc +++ b/chrome/browser/metrics/time_ticks_experiment_win.cc @@ -6,12 +6,13 @@ #if defined(OS_WIN) +#include <windows.h> +#include <algorithm> + #include "base/cpu.h" #include "base/metrics/histogram.h" #include "base/win/windows_version.h" -#include <windows.h> - namespace chrome { namespace { diff --git a/chrome/browser/sync_file_system/sync_file_system_service.h b/chrome/browser/sync_file_system/sync_file_system_service.h index 0d642e6..7bbea9d 100644 --- a/chrome/browser/sync_file_system/sync_file_system_service.h +++ b/chrome/browser/sync_file_system/sync_file_system_service.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ #include <map> +#include <memory> #include <string> #include "base/basictypes.h" @@ -91,7 +92,7 @@ class SyncFileSystemService friend class SyncFileSystemServiceFactory; friend class SyncFileSystemServiceTest; friend class SyncFileSystemTest; - friend struct base::DefaultDeleter<SyncFileSystemService>; + friend std::default_delete<SyncFileSystemService>; friend class LocalSyncRunner; friend class RemoteSyncRunner; diff --git a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc index 8772dce..95267720 100644 --- a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc +++ b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc @@ -90,7 +90,7 @@ void DrawTaskbarDecoration(gfx::NativeWindow window, const gfx::Image* image) { profiles::GetAvatarIconAsSquare(*image->ToSkBitmap(), 1))); } content::BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior( - FROM_HERE, base::Bind(&SetOverlayIcon, hwnd, Passed(&bitmap)), + FROM_HERE, base::Bind(&SetOverlayIcon, hwnd, base::Passed(&bitmap)), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); } diff --git a/chrome/browser/ui/views/profiles/user_manager_view.h b/chrome/browser/ui/views/profiles/user_manager_view.h index ae9e7ca..5f22b03 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.h +++ b/chrome/browser/ui/views/profiles/user_manager_view.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ +#include <memory> + #include "base/auto_reset.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/profiles/profile.h" @@ -41,7 +43,7 @@ class UserManagerView : public views::DialogDelegateView { private: ~UserManagerView() override; - friend struct base::DefaultDeleter<UserManagerView>; + friend std::default_delete<UserManagerView>; // Creates dialog and initializes UI. void Init(Profile* guest_profile, const GURL& url); diff --git a/chromeos/dbus/fake_modem_messaging_client.cc b/chromeos/dbus/fake_modem_messaging_client.cc index d68cfde..43ff75a 100644 --- a/chromeos/dbus/fake_modem_messaging_client.cc +++ b/chromeos/dbus/fake_modem_messaging_client.cc @@ -4,6 +4,7 @@ #include "chromeos/dbus/fake_modem_messaging_client.h" +#include <algorithm> #include <string> #include <vector> diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index bd1a7de..8d003bc 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h @@ -5,6 +5,7 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ +#include <memory> #include <set> #include <vector> @@ -244,7 +245,7 @@ class PersonalDataManager : public KeyedService, #endif friend class ProfileSyncServiceAutofillTest; friend class ::RemoveAutofillTester; - friend struct base::DefaultDeleter<PersonalDataManager>; + friend std::default_delete<PersonalDataManager>; friend void autofill_helper::SetProfiles( int, std::vector<autofill::AutofillProfile>*); friend void autofill_helper::SetCreditCards( diff --git a/components/cloud_devices/common/description_items.h b/components/cloud_devices/common/description_items.h index 1e8ed53..cd30ac1 100644 --- a/components/cloud_devices/common/description_items.h +++ b/components/cloud_devices/common/description_items.h @@ -8,6 +8,7 @@ // Defines common templates that could be used to create device specific // capabilities and print tickets. +#include <algorithm> #include <vector> #include "base/logging.h" diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index 67dad4e..0e6d9f0 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc @@ -171,7 +171,7 @@ void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( GetNetworkTaskRunner()->PostTask( FROM_HERE, base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread, - base::Unretained(this), Passed(&context_config_), + base::Unretained(this), base::Passed(&context_config_), jcaller_ref)); } diff --git a/components/cronet/android/url_request_adapter.cc b/components/cronet/android/url_request_adapter.cc index 43fb8f4..3195c27 100644 --- a/components/cronet/android/url_request_adapter.cc +++ b/components/cronet/android/url_request_adapter.cc @@ -86,11 +86,8 @@ void URLRequestAdapter::AppendChunk(const char* bytes, int bytes_len, memcpy(buf.get(), bytes, bytes_len); context_->PostTaskToNetworkThread( FROM_HERE, - base::Bind(&URLRequestAdapter::OnAppendChunk, - base::Unretained(this), - Passed(buf.Pass()), - bytes_len, - is_last_chunk)); + base::Bind(&URLRequestAdapter::OnAppendChunk, base::Unretained(this), + base::Passed(&buf), bytes_len, is_last_chunk)); } std::string URLRequestAdapter::GetHeader(const std::string& name) const { diff --git a/components/gcm_driver/fake_gcm_client.cc b/components/gcm_driver/fake_gcm_client.cc index e650009..6b71ebb 100644 --- a/components/gcm_driver/fake_gcm_client.cc +++ b/components/gcm_driver/fake_gcm_client.cc @@ -4,6 +4,8 @@ #include "components/gcm_driver/fake_gcm_client.h" +#include <algorithm> + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" diff --git a/components/invalidation/impl/mock_ack_handler.cc b/components/invalidation/impl/mock_ack_handler.cc index 859c77a..a0fbd69 100644 --- a/components/invalidation/impl/mock_ack_handler.cc +++ b/components/invalidation/impl/mock_ack_handler.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/mock_ack_handler.h" +#include <algorithm> + #include "base/thread_task_runner_handle.h" #include "components/invalidation/public/ack_handle.h" #include "components/invalidation/public/invalidation.h" diff --git a/components/memory_pressure/filtered_memory_pressure_calculator.cc b/components/memory_pressure/filtered_memory_pressure_calculator.cc index bf10f5a..ce4e607 100644 --- a/components/memory_pressure/filtered_memory_pressure_calculator.cc +++ b/components/memory_pressure/filtered_memory_pressure_calculator.cc @@ -4,6 +4,7 @@ #include "components/memory_pressure/filtered_memory_pressure_calculator.h" +#include <algorithm> #include "base/time/tick_clock.h" namespace memory_pressure { diff --git a/components/nacl/renderer/histogram.cc b/components/nacl/renderer/histogram.cc index 7f14657..970bf73 100644 --- a/components/nacl/renderer/histogram.cc +++ b/components/nacl/renderer/histogram.cc @@ -4,6 +4,8 @@ #include "components/nacl/renderer/histogram.h" +#include <algorithm> + #include "base/metrics/histogram.h" namespace nacl { diff --git a/components/proximity_auth/metrics.cc b/components/proximity_auth/metrics.cc index 7b4db8f..1e38803 100644 --- a/components/proximity_auth/metrics.cc +++ b/components/proximity_auth/metrics.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/metrics.h" +#include <algorithm> + #include "base/logging.h" #include "base/md5.h" #include "base/metrics/histogram_macros.h" diff --git a/components/proximity_auth/screenlock_bridge.h b/components/proximity_auth/screenlock_bridge.h index 9b47392..21a32dd 100644 --- a/components/proximity_auth/screenlock_bridge.h +++ b/components/proximity_auth/screenlock_bridge.h @@ -5,6 +5,7 @@ #ifndef COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ #define COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ +#include <memory> #include <string> #include "base/basictypes.h" @@ -172,7 +173,7 @@ class ScreenlockBridge { private: friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>; - friend struct base::DefaultDeleter<ScreenlockBridge>; + friend std::default_delete<ScreenlockBridge>; ScreenlockBridge(); ~ScreenlockBridge(); diff --git a/components/rappor/byte_vector_utils.cc b/components/rappor/byte_vector_utils.cc index 433f97a..ca64fd1 100644 --- a/components/rappor/byte_vector_utils.cc +++ b/components/rappor/byte_vector_utils.cc @@ -4,6 +4,7 @@ #include "components/rappor/byte_vector_utils.h" +#include <algorithm> #include <string> #include "base/logging.h" diff --git a/components/safe_json/json_sanitizer.cc b/components/safe_json/json_sanitizer.cc index e00043e..43ede85 100644 --- a/components/safe_json/json_sanitizer.cc +++ b/components/safe_json/json_sanitizer.cc @@ -8,6 +8,8 @@ #error Build json_sanitizer_android.cc instead of this file on Android. #endif +#include <memory> + #include "base/bind.h" #include "base/callback.h" #include "base/json/json_writer.h" @@ -27,7 +29,7 @@ class OopJsonSanitizer : public JsonSanitizer { const StringCallback& error_callback); private: - friend struct base::DefaultDeleter<OopJsonSanitizer>; + friend std::default_delete<OopJsonSanitizer>; ~OopJsonSanitizer() {} void OnParseSuccess(scoped_ptr<base::Value> value); diff --git a/components/safe_json/safe_json_parser_android.h b/components/safe_json/safe_json_parser_android.h index 2058731..ba29698 100644 --- a/components/safe_json/safe_json_parser_android.h +++ b/components/safe_json/safe_json_parser_android.h @@ -5,7 +5,8 @@ #ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_ANDROID_H_ #define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_ANDROID_H_ -#include "base/memory/scoped_ptr.h" +#include <memory> + #include "components/safe_json/safe_json_parser.h" namespace safe_json { @@ -19,7 +20,7 @@ class SafeJsonParserAndroid : public SafeJsonParser { const ErrorCallback& error_callback); private: - friend struct base::DefaultDeleter<SafeJsonParserAndroid>; + friend std::default_delete<SafeJsonParserAndroid>; ~SafeJsonParserAndroid() override; diff --git a/components/search_provider_logos/google_logo_api.cc b/components/search_provider_logos/google_logo_api.cc index 83542e9..227f9c9 100644 --- a/components/search_provider_logos/google_logo_api.cc +++ b/components/search_provider_logos/google_logo_api.cc @@ -4,6 +4,8 @@ #include "components/search_provider_logos/google_logo_api.h" +#include <algorithm> + #include "base/base64.h" #include "base/json/json_reader.h" #include "base/memory/ref_counted_memory.h" diff --git a/components/webcrypto/webcrypto_impl.cc b/components/webcrypto/webcrypto_impl.cc index 71d4b2b..0647b77 100644 --- a/components/webcrypto/webcrypto_impl.cc +++ b/components/webcrypto/webcrypto_impl.cc @@ -385,7 +385,7 @@ void DoEncrypt(scoped_ptr<EncryptState> passed_state) { webcrypto::Encrypt(state->algorithm, state->key, webcrypto::CryptoData(state->data), &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoEncryptReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoEncryptReply, base::Passed(&passed_state))); } void DoDecryptReply(scoped_ptr<DecryptState> state) { @@ -400,7 +400,7 @@ void DoDecrypt(scoped_ptr<DecryptState> passed_state) { webcrypto::Decrypt(state->algorithm, state->key, webcrypto::CryptoData(state->data), &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoDecryptReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoDecryptReply, base::Passed(&passed_state))); } void DoDigestReply(scoped_ptr<DigestState> state) { @@ -414,7 +414,7 @@ void DoDigest(scoped_ptr<DigestState> passed_state) { state->status = webcrypto::Digest( state->algorithm, webcrypto::CryptoData(state->data), &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoDigestReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoDigestReply, base::Passed(&passed_state))); } void DoGenerateKeyReply(scoped_ptr<GenerateKeyState> state) { @@ -433,7 +433,7 @@ void DoGenerateKey(scoped_ptr<GenerateKeyState> passed_state) { webcrypto::GenerateKey(state->algorithm, state->extractable, state->usages, &state->generate_key_result); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoGenerateKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoGenerateKeyReply, base::Passed(&passed_state))); } void DoImportKeyReply(scoped_ptr<ImportKeyState> state) { @@ -454,7 +454,7 @@ void DoImportKey(scoped_ptr<ImportKeyState> passed_state) { } state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoImportKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoImportKeyReply, base::Passed(&passed_state))); } void DoExportKeyReply(scoped_ptr<ExportKeyState> state) { @@ -479,7 +479,7 @@ void DoExportKey(scoped_ptr<ExportKeyState> passed_state) { state->status = webcrypto::ExportKey(state->format, state->key, &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoExportKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoExportKeyReply, base::Passed(&passed_state))); } void DoSignReply(scoped_ptr<SignState> state) { @@ -495,7 +495,7 @@ void DoSign(scoped_ptr<SignState> passed_state) { webcrypto::CryptoData(state->data), &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoSignReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoSignReply, base::Passed(&passed_state))); } void DoVerifyReply(scoped_ptr<VerifySignatureState> state) { @@ -515,7 +515,7 @@ void DoVerify(scoped_ptr<VerifySignatureState> passed_state) { webcrypto::CryptoData(state->data), &state->verify_result); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoVerifyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoVerifyReply, base::Passed(&passed_state))); } void DoWrapKeyReply(scoped_ptr<WrapKeyState> state) { @@ -531,7 +531,7 @@ void DoWrapKey(scoped_ptr<WrapKeyState> passed_state) { state->wrap_algorithm, &state->buffer); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoWrapKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoWrapKeyReply, base::Passed(&passed_state))); } void DoUnwrapKeyReply(scoped_ptr<UnwrapKeyState> state) { @@ -549,7 +549,7 @@ void DoUnwrapKey(scoped_ptr<UnwrapKeyState> passed_state) { &state->unwrapped_key); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoUnwrapKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoUnwrapKeyReply, base::Passed(&passed_state))); } void DoDeriveBitsReply(scoped_ptr<DeriveBitsState> state) { @@ -565,7 +565,7 @@ void DoDeriveBits(scoped_ptr<DeriveBitsState> passed_state) { webcrypto::DeriveBits(state->algorithm, state->base_key, state->length_bits, &state->derived_bytes); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoDeriveBitsReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoDeriveBitsReply, base::Passed(&passed_state))); } void DoDeriveKeyReply(scoped_ptr<DeriveKeyState> state) { @@ -581,7 +581,7 @@ void DoDeriveKey(scoped_ptr<DeriveKeyState> passed_state) { state->key_length_algorithm, state->extractable, state->usages, &state->derived_key); state->origin_thread->PostTask( - FROM_HERE, base::Bind(DoDeriveKeyReply, Passed(&passed_state))); + FROM_HERE, base::Bind(DoDeriveKeyReply, base::Passed(&passed_state))); } } // namespace @@ -601,8 +601,8 @@ void WebCryptoImpl::encrypt(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<EncryptState> state( new EncryptState(algorithm, key, data, data_size, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoEncrypt, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoEncrypt, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -616,8 +616,8 @@ void WebCryptoImpl::decrypt(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<DecryptState> state( new DecryptState(algorithm, key, data, data_size, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoDecrypt, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoDecrypt, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -631,7 +631,7 @@ void WebCryptoImpl::digest(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<DigestState> state(new DigestState( algorithm, blink::WebCryptoKey::createNull(), data, data_size, result)); if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoDigest, Passed(&state)))) { + base::Bind(DoDigest, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -644,8 +644,8 @@ void WebCryptoImpl::generateKey(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<GenerateKeyState> state( new GenerateKeyState(algorithm, extractable, usages, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoGenerateKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoGenerateKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -659,8 +659,8 @@ void WebCryptoImpl::importKey(blink::WebCryptoKeyFormat format, blink::WebCryptoResult result) { scoped_ptr<ImportKeyState> state(new ImportKeyState( format, key_data, key_data_size, algorithm, extractable, usages, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoImportKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoImportKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -669,8 +669,8 @@ void WebCryptoImpl::exportKey(blink::WebCryptoKeyFormat format, const blink::WebCryptoKey& key, blink::WebCryptoResult result) { scoped_ptr<ExportKeyState> state(new ExportKeyState(format, key, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoExportKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoExportKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -683,7 +683,7 @@ void WebCryptoImpl::sign(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<SignState> state( new SignState(algorithm, key, data, data_size, result)); if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoSign, Passed(&state)))) { + base::Bind(DoSign, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -698,7 +698,7 @@ void WebCryptoImpl::verifySignature(const blink::WebCryptoAlgorithm& algorithm, scoped_ptr<VerifySignatureState> state(new VerifySignatureState( algorithm, key, signature, signature_size, data, data_size, result)); if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoVerify, Passed(&state)))) { + base::Bind(DoVerify, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -710,8 +710,8 @@ void WebCryptoImpl::wrapKey(blink::WebCryptoKeyFormat format, blink::WebCryptoResult result) { scoped_ptr<WrapKeyState> state( new WrapKeyState(format, key, wrapping_key, wrap_algorithm, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoWrapKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoWrapKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -729,8 +729,8 @@ void WebCryptoImpl::unwrapKey( scoped_ptr<UnwrapKeyState> state(new UnwrapKeyState( format, wrapped_key, wrapped_key_size, wrapping_key, unwrap_algorithm, unwrapped_key_algorithm, extractable, usages, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoUnwrapKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoUnwrapKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -741,8 +741,8 @@ void WebCryptoImpl::deriveBits(const blink::WebCryptoAlgorithm& algorithm, blink::WebCryptoResult result) { scoped_ptr<DeriveBitsState> state( new DeriveBitsState(algorithm, base_key, length_bits, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoDeriveBits, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoDeriveBits, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } @@ -758,8 +758,8 @@ void WebCryptoImpl::deriveKey( scoped_ptr<DeriveKeyState> state( new DeriveKeyState(algorithm, base_key, import_algorithm, key_length_algorithm, extractable, usages, result)); - if (!CryptoThreadPool::PostTask(FROM_HERE, - base::Bind(DoDeriveKey, Passed(&state)))) { + if (!CryptoThreadPool::PostTask( + FROM_HERE, base::Bind(DoDeriveKey, base::Passed(&state)))) { CompleteWithThreadPoolError(&result); } } diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc index 5334541..ffbf464 100644 --- a/content/browser/indexed_db/indexed_db_database.cc +++ b/content/browser/indexed_db/indexed_db_database.cc @@ -552,7 +552,7 @@ void IndexedDBDatabase::GetAll(int64 transaction_id, transaction->ScheduleTask(base::Bind( &IndexedDBDatabase::GetAllOperation, this, object_store_id, index_id, - Passed(&key_range), + base::Passed(&key_range), key_only ? indexed_db::CURSOR_KEY_ONLY : indexed_db::CURSOR_KEY_AND_VALUE, max_count, callbacks)); } @@ -572,11 +572,8 @@ void IndexedDBDatabase::Get(int64 transaction_id, return; transaction->ScheduleTask(base::Bind( - &IndexedDBDatabase::GetOperation, - this, - object_store_id, - index_id, - Passed(&key_range), + &IndexedDBDatabase::GetOperation, this, object_store_id, index_id, + base::Passed(&key_range), key_only ? indexed_db::CURSOR_KEY_ONLY : indexed_db::CURSOR_KEY_AND_VALUE, callbacks)); } diff --git a/content/browser/renderer_host/p2p/socket_host.cc b/content/browser/renderer_host/p2p/socket_host.cc index f2e76c3..fefc4a5 100644 --- a/content/browser/renderer_host/p2p/socket_host.cc +++ b/content/browser/renderer_host/p2p/socket_host.cc @@ -638,14 +638,11 @@ void P2PSocketHost::DumpRtpPacket(const char* packet, // Posts to the IO thread as the data members should be accessed on the IO // thread only. - BrowserThread::PostTask(BrowserThread::IO, - FROM_HERE, - base::Bind(&P2PSocketHost::DumpRtpPacketOnIOThread, - weak_ptr_factory_.GetWeakPtr(), - Passed(&header_buffer), - header_length, - rtp_packet_length, - incoming)); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&P2PSocketHost::DumpRtpPacketOnIOThread, + weak_ptr_factory_.GetWeakPtr(), base::Passed(&header_buffer), + header_length, rtp_packet_length, incoming)); } void P2PSocketHost::DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, @@ -661,13 +658,10 @@ void P2PSocketHost::DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, } // |packet_dump_callback_| must be called on the UI thread. - BrowserThread::PostTask(BrowserThread::UI, - FROM_HERE, - base::Bind(packet_dump_callback_, - Passed(&packet_header), - header_length, - packet_length, - incoming)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(packet_dump_callback_, base::Passed(&packet_header), + header_length, packet_length, incoming)); } void P2PSocketHost::IncrementDelayedPackets() { diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_win.cc b/content/browser/renderer_host/pepper/pepper_truetype_font_win.cc index 633a326..5d572cd 100644 --- a/content/browser/renderer_host/pepper/pepper_truetype_font_win.cc +++ b/content/browser/renderer_host/pepper/pepper_truetype_font_win.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/pepper/pepper_truetype_font.h" #include <windows.h> +#include <algorithm> #include <set> #include "base/compiler_specific.h" diff --git a/content/browser/service_worker/service_worker_process_manager.cc b/content/browser/service_worker/service_worker_process_manager.cc index a310bcc..fbeaead 100644 --- a/content/browser/service_worker/service_worker_process_manager.cc +++ b/content/browser/service_worker/service_worker_process_manager.cc @@ -267,13 +267,13 @@ std::vector<int> ServiceWorkerProcessManager::SortProcessesForPattern( } // namespace content -namespace base { +namespace std { // Destroying ServiceWorkerProcessManagers only on the UI thread allows the // member WeakPtr to safely guard the object's lifetime when used on that // thread. -void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( +void default_delete<content::ServiceWorkerProcessManager>::operator()( content::ServiceWorkerProcessManager* ptr) const { content::BrowserThread::DeleteSoon( content::BrowserThread::UI, FROM_HERE, ptr); } -} // namespace base +} // namespace std diff --git a/content/browser/service_worker/service_worker_process_manager.h b/content/browser/service_worker/service_worker_process_manager.h index 10a43e8..0cb370b 100644 --- a/content/browser/service_worker/service_worker_process_manager.h +++ b/content/browser/service_worker/service_worker_process_manager.h @@ -6,6 +6,7 @@ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ #include <map> +#include <memory> #include <vector> #include "base/callback.h" @@ -130,12 +131,12 @@ class CONTENT_EXPORT ServiceWorkerProcessManager { } // namespace content -namespace base { +namespace std { // Specialized to post the deletion to the UI thread. template <> -struct CONTENT_EXPORT DefaultDeleter<content::ServiceWorkerProcessManager> { +struct CONTENT_EXPORT default_delete<content::ServiceWorkerProcessManager> { void operator()(content::ServiceWorkerProcessManager* ptr) const; }; -} // namespace base +} // namespace std #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ diff --git a/content/browser/service_worker/service_worker_script_cache_map.cc b/content/browser/service_worker/service_worker_script_cache_map.cc index 51a62b3..3607240 100644 --- a/content/browser/service_worker/service_worker_script_cache_map.cc +++ b/content/browser/service_worker/service_worker_script_cache_map.cc @@ -114,7 +114,7 @@ void ServiceWorkerScriptCacheMap::WriteMetadata( raw_writer->WriteMetadata( buffer.get(), data.size(), base::Bind(&ServiceWorkerScriptCacheMap::OnMetadataWritten, - weak_factory_.GetWeakPtr(), Passed(&writer), callback)); + weak_factory_.GetWeakPtr(), base::Passed(&writer), callback)); } void ServiceWorkerScriptCacheMap::ClearMetadata( diff --git a/content/browser/speech/speech_recognition_manager_impl.h b/content/browser/speech/speech_recognition_manager_impl.h index 9b8da39..634cd79 100644 --- a/content/browser/speech/speech_recognition_manager_impl.h +++ b/content/browser/speech/speech_recognition_manager_impl.h @@ -6,6 +6,7 @@ #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ #include <map> +#include <memory> #include <string> #include "base/basictypes.h" @@ -98,7 +99,7 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl : // BrowserMainLoop is the only one allowed to istantiate and free us. friend class BrowserMainLoop; // Needed for dtor. - friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>; + friend std::default_delete<SpeechRecognitionManagerImpl>; SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, MediaStreamManager* media_stream_manager); ~SpeechRecognitionManagerImpl() override; diff --git a/content/child/blob_storage/blob_consolidation.cc b/content/child/blob_storage/blob_consolidation.cc index 7bebdbc..4985059 100644 --- a/content/child/blob_storage/blob_consolidation.cc +++ b/content/child/blob_storage/blob_consolidation.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <string> - #include "content/child/blob_storage/blob_consolidation.h" +#include <algorithm> +#include <string> + using storage::DataElement; using blink::WebThreadSafeData; diff --git a/content/common/ax_content_node_data.cc b/content/common/ax_content_node_data.cc index 0c7359a..c7053b9 100644 --- a/content/common/ax_content_node_data.cc +++ b/content/common/ax_content_node_data.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/strings/string_number_conversions.h" #include "content/common/ax_content_node_data.h" +#include <algorithm> + +#include "base/strings/string_number_conversions.h" + using base::IntToString; namespace content { diff --git a/crypto/scoped_nss_types.h b/crypto/scoped_nss_types.h index fdfb83c..8e96e8d 100644 --- a/crypto/scoped_nss_types.h +++ b/crypto/scoped_nss_types.h @@ -16,7 +16,6 @@ namespace crypto { template <typename Type, void (*Destroyer)(Type*)> struct NSSDestroyer { - typedef void AllowSelfReset; void operator()(Type* ptr) const { Destroyer(ptr); } @@ -24,7 +23,6 @@ struct NSSDestroyer { template <typename Type, void (*Destroyer)(Type*, PRBool), PRBool freeit> struct NSSDestroyer1 { - typedef void AllowSelfReset; void operator()(Type* ptr) const { Destroyer(ptr, freeit); } diff --git a/crypto/scoped_openssl_types.h b/crypto/scoped_openssl_types.h index 73f7632..bdae6aa 100644 --- a/crypto/scoped_openssl_types.h +++ b/crypto/scoped_openssl_types.h @@ -23,7 +23,6 @@ namespace crypto { // base::internal::RunnableAdapter<>, but that's far too heavy weight. template <typename Type, void (*Destroyer)(Type*)> struct OpenSSLDestroyer { - using AllowSelfReset = void; void operator()(Type* ptr) const { Destroyer(ptr); } }; diff --git a/device/hid/device_monitor_linux.h b/device/hid/device_monitor_linux.h index 824fa65..23ad81a 100644 --- a/device/hid/device_monitor_linux.h +++ b/device/hid/device_monitor_linux.h @@ -5,6 +5,7 @@ #ifndef DEVICE_HID_DEVICE_MONITOR_LINUX_H_ #define DEVICE_HID_DEVICE_MONITOR_LINUX_H_ +#include <memory> #include <string> #include "base/compiler_specific.h" @@ -54,7 +55,7 @@ class DeviceMonitorLinux : public base::MessageLoop::DestructionObserver, void OnFileCanWriteWithoutBlocking(int fd) override; private: - friend struct base::DefaultDeleter<DeviceMonitorLinux>; + friend std::default_delete<DeviceMonitorLinux>; ~DeviceMonitorLinux() override; diff --git a/device/hid/input_service_linux.h b/device/hid/input_service_linux.h index d13be95..dfb11d1 100644 --- a/device/hid/input_service_linux.h +++ b/device/hid/input_service_linux.h @@ -5,6 +5,7 @@ #ifndef DEVICE_HID_INPUT_SERVICE_LINUX_H_ #define DEVICE_HID_INPUT_SERVICE_LINUX_H_ +#include <memory> #include <string> #include <vector> @@ -87,7 +88,7 @@ class InputServiceLinux : public base::MessageLoop::DestructionObserver { base::ObserverList<Observer> observers_; private: - friend struct base::DefaultDeleter<InputServiceLinux>; + friend std::default_delete<InputServiceLinux>; base::ThreadChecker thread_checker_; diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc index 99fdb76..b945205 100644 --- a/gpu/command_buffer/service/common_decoder.cc +++ b/gpu/command_buffer/service/common_decoder.cc @@ -4,6 +4,8 @@ #include "gpu/command_buffer/service/common_decoder.h" +#include <algorithm> + #include "base/numerics/safe_math.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 84f87fc..7c4eb7d 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -419,8 +419,8 @@ void ChannelProxy::Init(scoped_ptr<ChannelFactory> factory, context_->CreateChannel(factory.Pass()); } else { context_->ipc_task_runner()->PostTask( - FROM_HERE, base::Bind(&Context::CreateChannel, - context_.get(), Passed(factory.Pass()))); + FROM_HERE, base::Bind(&Context::CreateChannel, context_.get(), + base::Passed(&factory))); } // complete initialization on the background thread diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc index 8ae0de5..97330dc 100644 --- a/ipc/mojo/ipc_channel_mojo.cc +++ b/ipc/mojo/ipc_channel_mojo.cc @@ -4,6 +4,8 @@ #include "ipc/mojo/ipc_channel_mojo.h" +#include <memory> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" @@ -361,7 +363,7 @@ namespace { // ClosingDeleter calls |CloseWithErrorIfPending| before deleting the // |MessagePipeReader|. struct ClosingDeleter { - typedef base::DefaultDeleter<internal::MessagePipeReader> DefaultType; + typedef std::default_delete<internal::MessagePipeReader> DefaultType; void operator()(internal::MessagePipeReader* ptr) const { ptr->CloseWithErrorIfPending(); diff --git a/ipc/mojo/ipc_message_pipe_reader.h b/ipc/mojo/ipc_message_pipe_reader.h index 01e4fff..01baa37 100644 --- a/ipc/mojo/ipc_message_pipe_reader.h +++ b/ipc/mojo/ipc_message_pipe_reader.h @@ -5,6 +5,7 @@ #ifndef IPC_IPC_MESSAGE_PIPE_READER_H_ #define IPC_IPC_MESSAGE_PIPE_READER_H_ +#include <memory> #include <vector> #include "base/atomicops.h" @@ -49,7 +50,7 @@ class MessagePipeReader { // This is intended to used by MessagePipeReader owners. class DelayedDeleter { public: - typedef base::DefaultDeleter<MessagePipeReader> DefaultType; + typedef std::default_delete<MessagePipeReader> DefaultType; static void DeleteNow(MessagePipeReader* ptr) { delete ptr; } diff --git a/media/base/audio_buffer_converter.cc b/media/base/audio_buffer_converter.cc index 8c5ec1c..5fd92df 100644 --- a/media/base/audio_buffer_converter.cc +++ b/media/base/audio_buffer_converter.cc @@ -4,6 +4,7 @@ #include "media/base/audio_buffer_converter.h" +#include <algorithm> #include <cmath> #include "base/logging.h" diff --git a/media/base/serial_runner.h b/media/base/serial_runner.h index 9750e21..fb1b660 100644 --- a/media/base/serial_runner.h +++ b/media/base/serial_runner.h @@ -5,6 +5,7 @@ #ifndef MEDIA_BASE_SERIAL_RUNNER_H_ #define MEDIA_BASE_SERIAL_RUNNER_H_ +#include <memory> #include <queue> #include "base/callback.h" @@ -65,7 +66,7 @@ class MEDIA_EXPORT SerialRunner { const Queue& bound_fns, const PipelineStatusCB& done_cb); private: - friend struct base::DefaultDeleter<SerialRunner>; + friend std::default_delete<SerialRunner>; SerialRunner(const Queue& bound_fns, const PipelineStatusCB& done_cb); ~SerialRunner(); diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index 0b59cdf..20fba1f 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -17,6 +17,8 @@ #include "media/base/yuv_convert.h" +#include <algorithm> + #include "base/cpu.h" #include "base/lazy_instance.h" #include "base/logging.h" diff --git a/media/blink/interval_map.h b/media/blink/interval_map.h index 74cdca7..aa53003 100644 --- a/media/blink/interval_map.h +++ b/media/blink/interval_map.h @@ -5,6 +5,7 @@ #ifndef MEDIA_BLINK_INTERVAL_MAP_H_ #define MEDIA_BLINK_INTERVAL_MAP_H_ +#include <algorithm> #include <limits> #include <map> diff --git a/media/cast/logging/stats_event_subscriber.cc b/media/cast/logging/stats_event_subscriber.cc index 9d68710..a254e63 100644 --- a/media/cast/logging/stats_event_subscriber.cc +++ b/media/cast/logging/stats_event_subscriber.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <cmath> - #include "media/cast/logging/stats_event_subscriber.h" +#include <algorithm> +#include <cmath> + #include "base/format_macros.h" #include "base/logging.h" #include "base/strings/stringprintf.h" diff --git a/media/filters/vp9_parser.cc b/media/filters/vp9_parser.cc index b425f19..322aef2 100644 --- a/media/filters/vp9_parser.cc +++ b/media/filters/vp9_parser.cc @@ -6,6 +6,8 @@ #include "media/filters/vp9_parser.h" +#include <algorithm> + #include "base/logging.h" #include "base/numerics/safe_conversions.h" diff --git a/media/renderers/mock_gpu_video_accelerator_factories.h b/media/renderers/mock_gpu_video_accelerator_factories.h index f6c9dd7..57a73e1 100644 --- a/media/renderers/mock_gpu_video_accelerator_factories.h +++ b/media/renderers/mock_gpu_video_accelerator_factories.h @@ -5,6 +5,7 @@ #ifndef MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ #define MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" #include "media/renderers/gpu_video_accelerator_factories.h" @@ -12,9 +13,6 @@ #include "media/video/video_encode_accelerator.h" #include "testing/gmock/include/gmock/gmock.h" -template <class T> -class scoped_refptr; - namespace base { class SharedMemory; } diff --git a/media/video/video_decode_accelerator.cc b/media/video/video_decode_accelerator.cc index 0c6b2b9..7449a2a 100644 --- a/media/video/video_decode_accelerator.cc +++ b/media/video/video_decode_accelerator.cc @@ -38,14 +38,11 @@ VideoDecodeAccelerator::SupportedProfile::~SupportedProfile() { } // namespace media -namespace base { +namespace std { -void DefaultDeleter<media::VideoDecodeAccelerator>::operator()( - void* video_decode_accelerator) const { - static_cast<media::VideoDecodeAccelerator*>(video_decode_accelerator)-> - Destroy(); +void default_delete<media::VideoDecodeAccelerator>::operator()( + media::VideoDecodeAccelerator* vda) const { + vda->Destroy(); } -} // namespace base - - +} // namespace std diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index a53e352..e2bcdf6 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h @@ -5,6 +5,7 @@ #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ +#include <memory> #include <vector> #include "base/basictypes.h" @@ -190,19 +191,15 @@ class MEDIA_EXPORT VideoDecodeAccelerator { } // namespace media -namespace base { +namespace std { -template <class T> -struct DefaultDeleter; - -// Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAccelerator> always +// Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator> // uses "Destroy()" instead of trying to use the destructor. template <> -struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> { - public: - void operator()(void* video_decode_accelerator) const; +struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { + void operator()(media::VideoDecodeAccelerator* vda) const; }; -} // namespace base +} // namespace std #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ diff --git a/media/video/video_encode_accelerator.cc b/media/video/video_encode_accelerator.cc index dccd31d..51a4a7b 100644 --- a/media/video/video_encode_accelerator.cc +++ b/media/video/video_encode_accelerator.cc @@ -19,13 +19,11 @@ VideoEncodeAccelerator::SupportedProfile::~SupportedProfile() { } // namespace media -namespace base { +namespace std { -void DefaultDeleter<media::VideoEncodeAccelerator>::operator()( - void* video_encode_accelerator) const { - static_cast<media::VideoEncodeAccelerator*>(video_encode_accelerator)-> - Destroy(); +void default_delete<media::VideoEncodeAccelerator>::operator()( + media::VideoEncodeAccelerator* vea) const { + vea->Destroy(); } -} // namespace base - +} // namespace std diff --git a/media/video/video_encode_accelerator.h b/media/video/video_encode_accelerator.h index 6879b0d..39ad0b7 100644 --- a/media/video/video_encode_accelerator.h +++ b/media/video/video_encode_accelerator.h @@ -5,6 +5,7 @@ #ifndef MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ #define MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ +#include <memory> #include <vector> #include "base/basictypes.h" @@ -155,19 +156,15 @@ class MEDIA_EXPORT VideoEncodeAccelerator { } // namespace media -namespace base { +namespace std { -template <class T> -struct DefaultDeleter; - -// Specialize DefaultDeleter so that scoped_ptr<VideoEncodeAccelerator> always +// Specialize std::default_delete so that scoped_ptr<VideoEncodeAccelerator> // uses "Destroy()" instead of trying to use the destructor. template <> -struct MEDIA_EXPORT DefaultDeleter<media::VideoEncodeAccelerator> { - public: - void operator()(void* video_encode_accelerator) const; +struct MEDIA_EXPORT default_delete<media::VideoEncodeAccelerator> { + void operator()(media::VideoEncodeAccelerator* vea) const; }; -} // namespace base +} // namespace std #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ diff --git a/mojo/shell/data_pipe_peek.cc b/mojo/shell/data_pipe_peek.cc index 4c74c55..7007f24 100644 --- a/mojo/shell/data_pipe_peek.cc +++ b/mojo/shell/data_pipe_peek.cc @@ -6,6 +6,8 @@ #include <stdint.h> +#include <algorithm> + #include "base/bind.h" #include "base/macros.h" diff --git a/net/quic/crypto/strike_register.cc b/net/quic/crypto/strike_register.cc index c9b1353..d521adb 100644 --- a/net/quic/crypto/strike_register.cc +++ b/net/quic/crypto/strike_register.cc @@ -4,6 +4,7 @@ #include "net/quic/crypto/strike_register.h" +#include <algorithm> #include <limits> #include "base/logging.h" diff --git a/ppapi/shared_impl/ppb_audio_config_shared.cc b/ppapi/shared_impl/ppb_audio_config_shared.cc index 13f1925..74a0b32 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.cc +++ b/ppapi/shared_impl/ppb_audio_config_shared.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "build/build_config.h" #include "ppapi/shared_impl/ppb_audio_config_shared.h" + +#include <algorithm> + +#include "build/build_config.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_instance_api.h" diff --git a/remoting/base/compound_buffer.cc b/remoting/base/compound_buffer.cc index 3c599d3..c18592b 100644 --- a/remoting/base/compound_buffer.cc +++ b/remoting/base/compound_buffer.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "remoting/base/compound_buffer.h" + +#include <algorithm> #include <functional> #include "base/logging.h" #include "net/base/io_buffer.h" -#include "remoting/base/compound_buffer.h" namespace remoting { diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index c5403f6..71be967 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -7,6 +7,8 @@ #include "rlz/lib/rlz_lib.h" +#include <algorithm> + #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "rlz/lib/assert.h" diff --git a/sql/mojo/vfs_unittest.cc b/sql/mojo/vfs_unittest.cc index 123299b..33c6171 100644 --- a/sql/mojo/vfs_unittest.cc +++ b/sql/mojo/vfs_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "components/filesystem/public/interfaces/file_system.mojom.h" #include "mojo/application/public/cpp/application_impl.h" #include "mojo/application/public/cpp/application_test_base.h" @@ -10,12 +12,12 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/sqlite/sqlite3.h" -namespace base { +namespace std { // This deleter lets us be safe with sqlite3 objects, which aren't really the // structs, but slabs of new uint8_t[size]. template <> -struct DefaultDeleter<sqlite3_file> { +struct default_delete<sqlite3_file> { inline void operator()(sqlite3_file* ptr) const { // Why don't we call file->pMethods->xClose() here? Because it's not // guaranteed to be valid. sqlite3_file "objects" can be in partially @@ -24,7 +26,7 @@ struct DefaultDeleter<sqlite3_file> { } }; -} // namespace base +} // namespace std namespace sql { diff --git a/ui/accessibility/ax_node_data.cc b/ui/accessibility/ax_node_data.cc index 194880c..c7a50051 100644 --- a/ui/accessibility/ax_node_data.cc +++ b/ui/accessibility/ax_node_data.cc @@ -4,6 +4,7 @@ #include "ui/accessibility/ax_node_data.h" +#include <algorithm> #include <set> #include "base/strings/string_number_conversions.h" diff --git a/ui/base/x/x11_menu_list.cc b/ui/base/x/x11_menu_list.cc index 08f2c7d..a7c2fda 100644 --- a/ui/base/x/x11_menu_list.cc +++ b/ui/base/x/x11_menu_list.cc @@ -4,6 +4,8 @@ #include "ui/base/x/x11_menu_list.h" +#include <algorithm> + #include "base/memory/singleton.h" #include "ui/base/x/x11_util.h" diff --git a/ui/events/gesture_detection/gesture_detector.cc b/ui/events/gesture_detection/gesture_detector.cc index ec5e5ae..0dc4707 100644 --- a/ui/events/gesture_detection/gesture_detector.cc +++ b/ui/events/gesture_detection/gesture_detector.cc @@ -7,6 +7,7 @@ #include "ui/events/gesture_detection/gesture_detector.h" +#include <algorithm> #include <cmath> #include "base/timer/timer.h" diff --git a/ui/events/gesture_detection/scale_gesture_detector.cc b/ui/events/gesture_detection/scale_gesture_detector.cc index 7793aab..5fc55eb 100644 --- a/ui/events/gesture_detection/scale_gesture_detector.cc +++ b/ui/events/gesture_detection/scale_gesture_detector.cc @@ -6,6 +6,7 @@ #include <limits.h> +#include <algorithm> #include <cmath> #include "base/logging.h" diff --git a/ui/events/gesture_detection/snap_scroll_controller.cc b/ui/events/gesture_detection/snap_scroll_controller.cc index 9ecf6b1..b50971d 100644 --- a/ui/events/gesture_detection/snap_scroll_controller.cc +++ b/ui/events/gesture_detection/snap_scroll_controller.cc @@ -4,6 +4,7 @@ #include "ui/events/gesture_detection/snap_scroll_controller.h" +#include <algorithm> #include <cmath> #include "ui/events/gesture_detection/motion_event.h" diff --git a/ui/gfx/animation/linear_animation.cc b/ui/gfx/animation/linear_animation.cc index 0c9fa63..dd114a0 100644 --- a/ui/gfx/animation/linear_animation.cc +++ b/ui/gfx/animation/linear_animation.cc @@ -6,6 +6,8 @@ #include <math.h> +#include <algorithm> + #include "ui/gfx/animation/animation_container.h" #include "ui/gfx/animation/animation_delegate.h" diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc index 09c4b4b..1e6b71d 100644 --- a/ui/gfx/gdi_util.cc +++ b/ui/gfx/gdi_util.cc @@ -4,6 +4,8 @@ #include "ui/gfx/gdi_util.h" +#include <algorithm> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc index 89a3f8c..a9ed68c 100644 --- a/ui/gfx/image/image_util.cc +++ b/ui/gfx/image/image_util.cc @@ -4,6 +4,8 @@ #include "ui/gfx/image/image_util.h" +#include <algorithm> + #include "base/memory/scoped_ptr.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/jpeg_codec.h" diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc index f488274..a13b506 100644 --- a/ui/gl/gl_surface_osmesa.cc +++ b/ui/gl/gl_surface_osmesa.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "ui/gl/gl_surface_osmesa.h" + +#include <algorithm> + #include "base/logging.h" #include "base/numerics/safe_math.h" #include "third_party/mesa/src/include/GL/osmesa.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" -#include "ui/gl/gl_surface_osmesa.h" #include "ui/gl/scoped_make_current.h" namespace gfx { diff --git a/ui/gl/gpu_timing.h b/ui/gl/gpu_timing.h index 5d72d7c..4082b91 100644 --- a/ui/gl/gpu_timing.h +++ b/ui/gl/gpu_timing.h @@ -5,6 +5,7 @@ #ifndef UI_GL_GPU_TIMING_H_ #define UI_GL_GPU_TIMING_H_ +#include <memory> #include <queue> #include "base/callback.h" @@ -58,7 +59,7 @@ class GPUTiming { }; protected: - friend struct base::DefaultDeleter<GPUTiming>; + friend std::default_delete<GPUTiming>; friend class GLContextReal; static GPUTiming* CreateGPUTiming(GLContextReal* context); diff --git a/ui/touch_selection/touch_handle.cc b/ui/touch_selection/touch_handle.cc index 0fe3612..ad81711 100644 --- a/ui/touch_selection/touch_handle.cc +++ b/ui/touch_selection/touch_handle.cc @@ -4,6 +4,7 @@ #include "ui/touch_selection/touch_handle.h" +#include <algorithm> #include <cmath> namespace ui { |