diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 07:30:38 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 07:30:38 +0000 |
commit | 144b6c4d67fe81336112e4d702fb90c7aedb9bbf (patch) | |
tree | ea4c040b17e2fdb754e0416749abd51b4937b991 | |
parent | 3c7ca2f02b64ba078a4aab208dc35d0a002fc168 (diff) | |
download | chromium_src-144b6c4d67fe81336112e4d702fb90c7aedb9bbf.zip chromium_src-144b6c4d67fe81336112e4d702fb90c7aedb9bbf.tar.gz chromium_src-144b6c4d67fe81336112e4d702fb90c7aedb9bbf.tar.bz2 |
Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*"
BUG=110610
TBR=darin
Review URL: https://chromiumcodereview.appspot.com/16998003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206357 0039d316-1c4b-4281-b951-d872f2087c98
101 files changed, 870 insertions, 766 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index d42459d..83ffe46 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -174,7 +174,7 @@ gfx::ImageSkia DesktopBackgroundController::GetCurrentWallpaperImage() { } int DesktopBackgroundController::GetWallpaperIDR() const { - if (wallpaper_loader_) + if (wallpaper_loader_.get()) return wallpaper_loader_->idr(); else if (current_wallpaper_) return current_wallpaper_->wallpaper_info().idr; @@ -242,7 +242,7 @@ void DesktopBackgroundController::SetCustomWallpaper( void DesktopBackgroundController::CancelPendingWallpaperOperation() { // Set canceled flag of previous request to skip unneeded loading. - if (wallpaper_loader_) + if (wallpaper_loader_.get()) wallpaper_loader_->Cancel(); // Cancel reply callback for previous request. diff --git a/base/prefs/testing_pref_service.h b/base/prefs/testing_pref_service.h index ff15c4d..6fbf2eb 100644 --- a/base/prefs/testing_pref_service.h +++ b/base/prefs/testing_pref_service.h @@ -168,7 +168,7 @@ template<class SuperPrefService, class ConstructionPrefRegistry> void TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::RemoveRecommendedPref( const char* path) { - RemovePref(recommended_prefs_, path); + RemovePref(recommended_prefs_.get(), path); } template<class SuperPrefService, class ConstructionPrefRegistry> diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index 1713ee7..3cb51ea 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -421,7 +421,7 @@ void RasterWorkerPool::ScheduleRasterTasks(const RootTask& root) { scoped_refptr<internal::WorkerPoolTask> new_root(root.internal_); TaskGraph graph; - BuildTaskGraph(new_root, &graph); + BuildTaskGraph(new_root.get(), &graph); WorkerPool::SetTaskGraph(&graph); root_.swap(new_root); diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service_unittest.cc b/chrome/browser/chromeos/contacts/gdata_contacts_service_unittest.cc index d97845e..0ffe075 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service_unittest.cc +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service_unittest.cc @@ -91,9 +91,8 @@ class GDataContactsServiceTest : public testing::Test { test_server_->RegisterRequestHandler( base::Bind(&GDataContactsServiceTest::HandleDownloadRequest, base::Unretained(this))); - service_.reset(new GDataContactsService( - request_context_getter_, - profile_.get())); + service_.reset(new GDataContactsService(request_context_getter_.get(), + profile_.get())); service_->Initialize(); service_->auth_service_for_testing()->set_access_token_for_testing( kTestGDataAuthToken); diff --git a/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc b/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc index a3814cc..4ab2930 100644 --- a/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc +++ b/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc @@ -42,7 +42,7 @@ class CrosDBusServiceTest : public testing::Test { mock_bus_ = new dbus::MockBus(options); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create a mock exported object that behaves as // org.chromium.CrosDBusService. @@ -52,8 +52,8 @@ class CrosDBusServiceTest : public testing::Test { // |mock_bus_|'s GetExportedObject() will return mock_exported_object_| // for the given service name and the object path. - EXPECT_CALL(*mock_bus_, GetExportedObject( - dbus::ObjectPath(kLibCrosServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetExportedObject(dbus::ObjectPath(kLibCrosServicePath))) .WillOnce(Return(mock_exported_object_.get())); // Create a mock proxy resolution service. @@ -65,7 +65,7 @@ class CrosDBusServiceTest : public testing::Test { Start(Eq(mock_exported_object_))).WillOnce(Return()); // Initialize the cros service with the mocks injected. CrosDBusService::InitializeForTesting( - mock_bus_, mock_proxy_resolution_service_provider); + mock_bus_.get(), mock_proxy_resolution_service_provider); } virtual void TearDown() { diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc index c72d30d..d2eb77a 100644 --- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc +++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc @@ -116,7 +116,7 @@ class ProxyResolverImpl : public ProxyResolverInterface { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Check if we have the URLRequestContextGetter. - if (!getter) { + if (!getter.get()) { request->error_ = "No URLRequestContextGetter"; request->OnCompletion(net::ERR_UNEXPECTED); return; diff --git a/chrome/browser/chromeos/dbus/service_provider_test_helper.cc b/chrome/browser/chromeos/dbus/service_provider_test_helper.cc index 57ee646..f28248c 100644 --- a/chrome/browser/chromeos/dbus/service_provider_test_helper.cc +++ b/chrome/browser/chromeos/dbus/service_provider_test_helper.cc @@ -36,7 +36,7 @@ void ServiceProviderTestHelper::SetUp( mock_bus_ = new dbus::MockBus(options); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create a mock exported object that behaves as // org.chromium.CrosDBusService. @@ -46,9 +46,9 @@ void ServiceProviderTestHelper::SetUp( // |mock_exported_object_|'s ExportMethod() will use // |MockExportedObject(). - EXPECT_CALL(*mock_exported_object_, - ExportMethod(kLibCrosServiceInterface, - exported_method_name, _, _)) + EXPECT_CALL( + *mock_exported_object_.get(), + ExportMethod(kLibCrosServiceInterface, exported_method_name, _, _)) .WillOnce(Invoke(this, &ServiceProviderTestHelper::MockExportMethod)); // Create a mock object proxy, with which we call a method of @@ -59,18 +59,15 @@ void ServiceProviderTestHelper::SetUp( dbus::ObjectPath(kLibCrosServicePath)); // |mock_object_proxy_|'s MockCallMethodAndBlock() will use // MockCallMethodAndBlock() to return responses. - EXPECT_CALL(*mock_object_proxy_, + EXPECT_CALL(*mock_object_proxy_.get(), MockCallMethodAndBlock( - AllOf( - ResultOf( - std::mem_fun(&dbus::MethodCall::GetInterface), - kLibCrosServiceInterface), - ResultOf( - std::mem_fun(&dbus::MethodCall::GetMember), - exported_method_name)), + AllOf(ResultOf(std::mem_fun(&dbus::MethodCall::GetInterface), + kLibCrosServiceInterface), + ResultOf(std::mem_fun(&dbus::MethodCall::GetMember), + exported_method_name)), _)) - .WillOnce(Invoke(this, - &ServiceProviderTestHelper::MockCallMethodAndBlock)); + .WillOnce( + Invoke(this, &ServiceProviderTestHelper::MockCallMethodAndBlock)); service_provider->Start(mock_exported_object_.get()); } @@ -89,12 +86,12 @@ void ServiceProviderTestHelper::SetUpReturnSignal( dbus::ObjectProxy::OnConnectedCallback on_connected_callback) { // |mock_exported_object_|'s SendSignal() will use // MockSendSignal(). - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(this, &ServiceProviderTestHelper::MockSendSignal)); // |mock_object_proxy_|'s ConnectToSignal will use // MockConnectToSignal(). - EXPECT_CALL(*mock_object_proxy_, + EXPECT_CALL(*mock_object_proxy_.get(), ConnectToSignal(interface_name, signal_name, _, _)) .WillOnce(Invoke(this, &ServiceProviderTestHelper::MockConnectToSignal)); diff --git a/chrome/browser/chromeos/drive/change_list_processor_unittest.cc b/chrome/browser/chromeos/drive/change_list_processor_unittest.cc index b0096fc1..2a4dcad 100644 --- a/chrome/browser/chromeos/drive/change_list_processor_unittest.cc +++ b/chrome/browser/chromeos/drive/change_list_processor_unittest.cc @@ -118,7 +118,7 @@ class ChangeListProcessorTest : public testing::Test { FileError error = FILE_ERROR_FAILED; scoped_ptr<ResourceEntry> entry(new ResourceEntry); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, base::Unretained(metadata_.get()), @@ -135,12 +135,12 @@ class ChangeListProcessorTest : public testing::Test { int64 GetChangestamp() { int64 changestamp = -1; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&internal::ResourceMetadata::GetLargestChangestamp, base::Unretained(metadata_.get())), - base::Bind(google_apis::test_util::CreateCopyResultCallback( - &changestamp))); + base::Bind( + google_apis::test_util::CreateCopyResultCallback(&changestamp))); google_apis::test_util::RunBlockingPoolTask(); return changestamp; } diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc index 3d6a7e2..7117085 100644 --- a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc +++ b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc @@ -143,7 +143,7 @@ int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, const net::CompletionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Check if there is no pending Read operation. - DCHECK(!buffer_); + DCHECK(!buffer_.get()); DCHECK_EQ(buffer_length_, 0); DCHECK(callback_.is_null()); // Validate the arguments. @@ -197,7 +197,7 @@ void NetworkReaderProxy::OnGetContent(scoped_ptr<std::string> data) { } pending_data_.push_back(data.release()); - if (!buffer_) { + if (!buffer_.get()) { // No pending Read operation. return; } @@ -380,7 +380,7 @@ void DriveFileStreamReader::InitializeAfterGetFileContentByPathInitialized( // Otherwise, open the stream for file. scoped_ptr<util::LocalFileReader> file_reader( - new util::LocalFileReader(file_task_runner_)); + new util::LocalFileReader(file_task_runner_.get())); util::LocalFileReader* file_reader_ptr = file_reader.get(); file_reader_ptr->Open( local_cache_file_path, diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc index f3c4e1a..b1bfcaf 100644 --- a/chrome/browser/chromeos/drive/drive_integration_service.cc +++ b/chrome/browser/chromeos/drive/drive_integration_service.cc @@ -118,9 +118,9 @@ DriveIntegrationService::DriveIntegrationService( } scheduler_.reset(new JobScheduler(profile_, drive_service_.get())); cache_.reset(new internal::FileCache( - !test_cache_root.empty() ? test_cache_root : - util::GetCacheRootPath(profile), - blocking_task_runner_, + !test_cache_root.empty() ? test_cache_root + : util::GetCacheRootPath(profile), + blocking_task_runner_.get(), NULL /* free_disk_space_getter */)); drive_app_registry_.reset(new DriveAppRegistry(scheduler_.get())); @@ -130,13 +130,14 @@ DriveIntegrationService::DriveIntegrationService( cache_->GetCacheDirectoryPath(internal::FileCache::CACHE_TYPE_META), blocking_task_runner_)); - file_system_.reset(test_file_system ? test_file_system : - new FileSystem(profile_, - cache_.get(), - drive_service_.get(), - scheduler_.get(), - resource_metadata_.get(), - blocking_task_runner_)); + file_system_.reset(test_file_system + ? test_file_system + : new FileSystem(profile_, + cache_.get(), + drive_service_.get(), + scheduler_.get(), + resource_metadata_.get(), + blocking_task_runner_.get())); file_write_helper_.reset(new FileWriteHelper(file_system())); download_handler_.reset(new DownloadHandler(file_write_helper(), file_system())); @@ -259,7 +260,7 @@ void DriveIntegrationService::AddDriveMountPoint() { bool success = mount_points->RegisterRemoteFileSystem( drive_mount_point.BaseName().AsUTF8Unsafe(), fileapi::kFileSystemTypeDrive, - file_system_proxy_, + file_system_proxy_.get(), drive_mount_point); if (success) { @@ -283,7 +284,7 @@ void DriveIntegrationService::RemoveDriveMountPoint() { mount_points->RevokeFileSystem( util::GetDriveMountPointPath().BaseName().AsUTF8Unsafe()); - if (file_system_proxy_) { + if (file_system_proxy_.get()) { file_system_proxy_->DetachFromFileSystem(); file_system_proxy_ = NULL; } diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.cc b/chrome/browser/chromeos/drive/drive_protocol_handler.cc index 1f49f23..441b582 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.cc +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.cc @@ -52,7 +52,7 @@ net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) const { DVLOG(1) << "Handling url: " << request->url().spec(); return new DriveURLRequestJob(base::Bind(&GetFileSystem, profile_id_), - blocking_task_runner_, + blocking_task_runner_.get(), request, network_delegate); } diff --git a/chrome/browser/chromeos/drive/drive_url_request_job.cc b/chrome/browser/chromeos/drive/drive_url_request_job.cc index 3aa56d5..2e1ebb1 100644 --- a/chrome/browser/chromeos/drive/drive_url_request_job.cc +++ b/chrome/browser/chromeos/drive/drive_url_request_job.cc @@ -99,7 +99,7 @@ void DriveURLRequestJob::Start() { // Initialize the stream reader. stream_reader_.reset( - new DriveFileStreamReader(file_system_getter_, file_task_runner_)); + new DriveFileStreamReader(file_system_getter_, file_task_runner_.get())); stream_reader_->Initialize( drive_file_path, byte_range_, diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc index e65342d..6f2a4ae 100644 --- a/chrome/browser/chromeos/drive/file_cache.cc +++ b/chrome/browser/chromeos/drive/file_cache.cc @@ -214,7 +214,7 @@ FileCache::FileCache(const base::FilePath& cache_root_path, blocking_task_runner_(blocking_task_runner), free_disk_space_getter_(free_disk_space_getter), weak_ptr_factory_(this) { - DCHECK(blocking_task_runner_); + DCHECK(blocking_task_runner_.get()); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } @@ -256,7 +256,7 @@ base::FilePath FileCache::GetCacheFilePath(const std::string& resource_id, } void FileCache::AssertOnSequencedWorkerPool() { - DCHECK(!blocking_task_runner_ || + DCHECK(!blocking_task_runner_.get() || blocking_task_runner_->RunsTasksOnCurrentThread()); } @@ -272,12 +272,15 @@ void FileCache::GetCacheEntryOnUIThread(const std::string& resource_id, FileCacheEntry* cache_entry = new FileCacheEntry; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::GetCacheEntry, - base::Unretained(this), resource_id, md5, cache_entry), - base::Bind(&RunGetCacheEntryCallback, - callback, base::Owned(cache_entry))); + base::Unretained(this), + resource_id, + md5, + cache_entry), + base::Bind( + &RunGetCacheEntryCallback, callback, base::Owned(cache_entry))); } bool FileCache::GetCacheEntry(const std::string& resource_id, @@ -321,7 +324,7 @@ void FileCache::FreeDiskSpaceIfNeededForOnUIThread( DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::FreeDiskSpaceIfNeededFor, base::Unretained(this), @@ -374,13 +377,16 @@ void FileCache::GetFileOnUIThread(const std::string& resource_id, DCHECK(!callback.is_null()); base::FilePath* cache_file_path = new base::FilePath; - base::PostTaskAndReplyWithResult( - blocking_task_runner_, - FROM_HERE, - base::Bind(&FileCache::GetFile, - base::Unretained(this), resource_id, md5, cache_file_path), - base::Bind(&RunGetFileFromCacheCallback, - callback, base::Owned(cache_file_path))); + base::PostTaskAndReplyWithResult(blocking_task_runner_.get(), + FROM_HERE, + base::Bind(&FileCache::GetFile, + base::Unretained(this), + resource_id, + md5, + cache_file_path), + base::Bind(&RunGetFileFromCacheCallback, + callback, + base::Owned(cache_file_path))); } FileError FileCache::GetFile(const std::string& resource_id, @@ -416,13 +422,15 @@ void FileCache::StoreOnUIThread(const std::string& resource_id, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - base::PostTaskAndReplyWithResult( - blocking_task_runner_, - FROM_HERE, - base::Bind(&FileCache::Store, - base::Unretained(this), - resource_id, md5, source_path, file_operation_type), - callback); + base::PostTaskAndReplyWithResult(blocking_task_runner_.get(), + FROM_HERE, + base::Bind(&FileCache::Store, + base::Unretained(this), + resource_id, + md5, + source_path, + file_operation_type), + callback); } FileError FileCache::Store(const std::string& resource_id, @@ -440,7 +448,7 @@ void FileCache::PinOnUIThread(const std::string& resource_id, DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::Pin, base::Unretained(this), resource_id, md5), callback); @@ -465,7 +473,7 @@ void FileCache::UnpinOnUIThread(const std::string& resource_id, DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::Unpin, base::Unretained(this), resource_id, md5), callback); @@ -508,12 +516,14 @@ void FileCache::MarkAsMountedOnUIThread( base::FilePath* cache_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::MarkAsMounted, - base::Unretained(this), resource_id, cache_file_path), - base::Bind(RunGetFileFromCacheCallback, - callback, base::Owned(cache_file_path))); + base::Unretained(this), + resource_id, + cache_file_path), + base::Bind( + RunGetFileFromCacheCallback, callback, base::Owned(cache_file_path))); } void FileCache::MarkAsUnmountedOnUIThread( @@ -523,10 +533,10 @@ void FileCache::MarkAsUnmountedOnUIThread( DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&FileCache::MarkAsUnmounted, - base::Unretained(this), file_path), + base::Bind( + &FileCache::MarkAsUnmounted, base::Unretained(this), file_path), callback); } @@ -537,10 +547,10 @@ void FileCache::MarkDirtyOnUIThread(const std::string& resource_id, DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&FileCache::MarkDirty, - base::Unretained(this), resource_id, md5), + base::Bind( + &FileCache::MarkDirty, base::Unretained(this), resource_id, md5), callback); } @@ -631,10 +641,9 @@ void FileCache::RemoveOnUIThread(const std::string& resource_id, DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&FileCache::Remove, - base::Unretained(this), resource_id), + base::Bind(&FileCache::Remove, base::Unretained(this), resource_id), callback); } @@ -670,7 +679,7 @@ void FileCache::ClearAllOnUIThread(const InitializeCacheCallback& callback) { DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::ClearAll, base::Unretained(this)), callback); @@ -681,7 +690,7 @@ void FileCache::RequestInitialize(const InitializeCacheCallback& callback) { DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::InitializeOnBlockingPool, base::Unretained(this)), callback); @@ -709,7 +718,7 @@ bool FileCache::InitializeOnBlockingPool() { MigrateFilesFromOldDirectories(); - metadata_.reset(new FileCacheMetadata(blocking_task_runner_)); + metadata_.reset(new FileCacheMetadata(blocking_task_runner_.get())); switch (metadata_->Initialize(cache_paths_[CACHE_TYPE_META])) { case FileCacheMetadata::INITIALIZE_FAILED: diff --git a/chrome/browser/chromeos/drive/file_cache_metadata.cc b/chrome/browser/chromeos/drive/file_cache_metadata.cc index 2b72d8f..03ca62e 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/file_cache_metadata.cc @@ -189,7 +189,7 @@ scoped_ptr<FileCacheMetadata::Iterator> FileCacheMetadata::GetIterator() { } void FileCacheMetadata::AssertOnSequencedWorkerPool() { - DCHECK(!blocking_task_runner_ || + DCHECK(!blocking_task_runner_.get() || blocking_task_runner_->RunsTasksOnCurrentThread()); } diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index cf2d15d..327fca8 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -61,7 +61,7 @@ class FileCacheTestOnUIThread : public testing::Test { blocking_task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); cache_.reset(new FileCache(temp_dir_.path(), - blocking_task_runner_, + blocking_task_runner_.get(), fake_free_disk_space_getter_.get())); bool success = false; @@ -243,11 +243,12 @@ class FileCacheTestOnUIThread : public testing::Test { FileError error = FILE_ERROR_OK; PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&FileCache::ClearDirty, base::Unretained(cache_.get()), - resource_id, md5), + resource_id, + md5), google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); VerifyCacheFileState(error, resource_id, md5); diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc index 82e036b..f0ec525 100644 --- a/chrome/browser/chromeos/drive/file_system.cc +++ b/chrome/browser/chromeos/drive/file_system.cc @@ -101,27 +101,50 @@ void FileSystem::Initialize() { SetupChangeListLoader(); file_system::OperationObserver* observer = this; - copy_operation_.reset(new file_system::CopyOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_, - drive_service_)); + copy_operation_.reset( + new file_system::CopyOperation(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_, + drive_service_)); create_directory_operation_.reset(new file_system::CreateDirectoryOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_)); - create_file_operation_.reset(new file_system::CreateFileOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_)); - move_operation_.reset(new file_system::MoveOperation( - observer, scheduler_, resource_metadata_)); - remove_operation_.reset(new file_system::RemoveOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_)); + blocking_task_runner_.get(), observer, scheduler_, resource_metadata_)); + create_file_operation_.reset( + new file_system::CreateFileOperation(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_)); + move_operation_.reset( + new file_system::MoveOperation(observer, scheduler_, resource_metadata_)); + remove_operation_.reset( + new file_system::RemoveOperation(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_)); touch_operation_.reset(new file_system::TouchOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_)); - download_operation_.reset(new file_system::DownloadOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_)); - update_operation_.reset(new file_system::UpdateOperation( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_)); + blocking_task_runner_.get(), observer, scheduler_, resource_metadata_)); + download_operation_.reset( + new file_system::DownloadOperation(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_)); + update_operation_.reset( + new file_system::UpdateOperation(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_)); search_operation_.reset(new file_system::SearchOperation( - blocking_task_runner_, scheduler_, resource_metadata_)); - sync_client_.reset(new internal::SyncClient( - blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_)); + blocking_task_runner_.get(), scheduler_, resource_metadata_)); + sync_client_.reset(new internal::SyncClient(blocking_task_runner_.get(), + observer, + scheduler_, + resource_metadata_, + cache_)); PrefService* pref_service = profile_->GetPrefs(); hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); @@ -146,7 +169,7 @@ void FileSystem::ReloadAfterReset(FileError error) { void FileSystem::SetupChangeListLoader() { change_list_loader_.reset(new internal::ChangeListLoader( - blocking_task_runner_, resource_metadata_, scheduler_)); + blocking_task_runner_.get(), resource_metadata_, scheduler_)); change_list_loader_->AddObserver(this); } @@ -1094,7 +1117,7 @@ void FileSystem::CheckLocalModificationAndRunAfterGetCacheFile( // If the cache is dirty, obtain the file info from the cache file itself. base::PlatformFileInfo* file_info = new base::PlatformFileInfo; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&file_util::GetFileInfo, local_cache_path, diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc index 8978e0e..3a4c561 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc @@ -133,11 +133,10 @@ void CopyOperation::OnGetFileCompleteForTransferFile( // copied to the actual destination path on the local file system using // CopyLocalFileOnBlockingPool. base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&CopyLocalFileOnBlockingPool, - local_file_path, - local_dest_file_path), + base::Bind( + &CopyLocalFileOnBlockingPool, local_file_path, local_dest_file_path), callback); } @@ -208,7 +207,7 @@ void CopyOperation::ScheduleTransferRegularFileAfterGetResourceEntry( ResourceEntry* entry_ptr = entry.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&StoreAndMarkDirty, cache_, @@ -384,7 +383,7 @@ void CopyOperation::OnCopyResourceCompleted( // The copy on the server side is completed successfully. Update the local // metadata. base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&internal::ResourceMetadata::AddEntry, base::Unretained(metadata_), @@ -434,7 +433,7 @@ void CopyOperation::TransferFileFromLocalToRemoteAfterGetResourceEntry( if (util::HasGDocFileExtension(local_src_file_path)) { base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&util::ReadResourceIdFromGDocFile, local_src_file_path), base::Bind(&CopyOperation::TransferFileForResourceId, diff --git a/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc b/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc index ec63af00..7cd5a0d 100644 --- a/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc @@ -71,15 +71,20 @@ void CreateDirectoryOperation::CreateDirectory( ResourceEntry* entry = new ResourceEntry; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&CreateDirectoryOperation::GetExistingDeepestDirectory, - metadata_, directory_path, entry), - base::Bind(&CreateDirectoryOperation - ::CreateDirectoryAfterGetExistingDeepestDirectory, + metadata_, + directory_path, + entry), + base::Bind(&CreateDirectoryOperation:: + CreateDirectoryAfterGetExistingDeepestDirectory, weak_ptr_factory_.GetWeakPtr(), - directory_path, is_exclusive, is_recursive, - callback, base::Owned(entry))); + directory_path, + is_exclusive, + is_recursive, + callback, + base::Owned(entry))); } // static @@ -197,15 +202,19 @@ void CreateDirectoryOperation::CreateDirectoryRecursivelyAfterAddNewDirectory( // to create). base::FilePath* file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&UpdateLocalStateForCreateDirectoryRecursively, - metadata_, ConvertToResourceEntry(*resource_entry), file_path), - base::Bind(&CreateDirectoryOperation - ::CreateDirectoryRecursivelyAfterUpdateLocalState, + metadata_, + ConvertToResourceEntry(*resource_entry), + file_path), + base::Bind(&CreateDirectoryOperation:: + CreateDirectoryRecursivelyAfterUpdateLocalState, weak_ptr_factory_.GetWeakPtr(), resource_entry->resource_id(), - remaining_path, callback, base::Owned(file_path))); + remaining_path, + callback, + base::Owned(file_path))); } void CreateDirectoryOperation::CreateDirectoryRecursivelyAfterUpdateLocalState( diff --git a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc index b31570c..2d25180 100644 --- a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc @@ -145,15 +145,20 @@ void CreateFileOperation::CreateFile(const base::FilePath& file_path, std::string* parent_resource_id = new std::string; std::string* mime_type = new std::string; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&CheckPreConditionForCreateFile, - metadata_, file_path, is_exclusive, - parent_resource_id, mime_type), + metadata_, + file_path, + is_exclusive, + parent_resource_id, + mime_type), base::Bind(&CreateFileOperation::CreateFileAfterCheckPreCondition, weak_ptr_factory_.GetWeakPtr(), - file_path, callback, - base::Owned(parent_resource_id), base::Owned(mime_type))); + file_path, + callback, + base::Owned(parent_resource_id), + base::Owned(mime_type))); } void CreateFileOperation::CreateFileAfterCheckPreCondition( @@ -201,13 +206,17 @@ void CreateFileOperation::CreateFileAfterUpload( base::FilePath* file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&UpdateLocalStateForCreateFile, - metadata_, cache_, base::Passed(&resource_entry), file_path), + metadata_, + cache_, + base::Passed(&resource_entry), + file_path), base::Bind(&CreateFileOperation::CreateFileAfterUpdateLocalState, weak_ptr_factory_.GetWeakPtr(), - callback, base::Owned(file_path))); + callback, + base::Owned(file_path))); } void CreateFileOperation::CreateFileAfterUpdateLocalState( diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc index 038b8df..2582859 100644 --- a/chrome/browser/chromeos/drive/file_system/download_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc @@ -322,7 +322,7 @@ void DownloadOperation::EnsureFileDownloadedByResourceId( ResourceEntry* entry = new ResourceEntry; base::FilePath* cache_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&CheckPreConditionForEnsureFileDownloadedByResourceId, base::Unretained(metadata_), @@ -353,7 +353,7 @@ void DownloadOperation::EnsureFileDownloadedByPath( ResourceEntry* entry = new ResourceEntry; base::FilePath* cache_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&CheckPreConditionForEnsureFileDownloadedByPath, base::Unretained(metadata_), @@ -442,7 +442,7 @@ void DownloadOperation::EnsureFileDownloadedAfterGetResourceEntry( // the cache space. DownloadParams* params = new DownloadParams(context, download_url); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&PrepareForDownloadFile, base::Unretained(metadata_), @@ -501,7 +501,7 @@ void DownloadOperation::EnsureFileDownloadedAfterDownloadFile( ResourceEntry* entry_ptr = entry.get(); base::FilePath* cache_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&UpdateLocalStateForDownloadFile, base::Unretained(cache_), diff --git a/chrome/browser/chromeos/drive/file_system/operation_test_base.cc b/chrome/browser/chromeos/drive/file_system/operation_test_base.cc index de7fa8e..a0217bb 100644 --- a/chrome/browser/chromeos/drive/file_system/operation_test_base.cc +++ b/chrome/browser/chromeos/drive/file_system/operation_test_base.cc @@ -71,7 +71,7 @@ void OperationTestBase::SetUp() { fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); cache_.reset(new internal::FileCache(temp_dir_.path(), - blocking_task_runner_, + blocking_task_runner_.get(), fake_free_disk_space_getter_.get())); bool success = false; cache_->RequestInitialize( @@ -81,7 +81,7 @@ void OperationTestBase::SetUp() { // Makes sure the FakeDriveService's content is loaded to the metadata_. internal::ChangeListLoader change_list_loader( - blocking_task_runner_, metadata_.get(), scheduler_.get()); + blocking_task_runner_.get(), metadata_.get(), scheduler_.get()); change_list_loader.LoadIfNeeded( DirectoryFetchInfo(), diff --git a/chrome/browser/chromeos/drive/file_system/operation_test_base.h b/chrome/browser/chromeos/drive/file_system/operation_test_base.h index a35784e..f02ddd4 100644 --- a/chrome/browser/chromeos/drive/file_system/operation_test_base.h +++ b/chrome/browser/chromeos/drive/file_system/operation_test_base.h @@ -91,7 +91,7 @@ class OperationTestBase : public testing::Test { LoggingObserver* observer() { return &observer_; } JobScheduler* scheduler() { return scheduler_.get(); } base::SequencedTaskRunner* blocking_task_runner() { - return blocking_task_runner_; + return blocking_task_runner_.get(); } internal::ResourceMetadata* metadata() { return metadata_.get(); } FakeFreeDiskSpaceGetter* fake_free_disk_space_getter() { diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index 8448566..6d5f2b4 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -86,13 +86,9 @@ void RemoveOperation::Remove(const base::FilePath& path, ResourceEntry* entry = new ResourceEntry; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&CheckLocalState, - metadata_, - path, - is_recursive, - entry), + base::Bind(&CheckLocalState, metadata_, path, is_recursive, entry), base::Bind(&RemoveOperation::RemoveAfterCheckLocalState, weak_ptr_factory_.GetWeakPtr(), callback, @@ -134,7 +130,7 @@ void RemoveOperation::RemoveAfterDeleteResource( base::FilePath* changed_directory_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&UpdateLocalState, metadata_, diff --git a/chrome/browser/chromeos/drive/file_system/search_operation.cc b/chrome/browser/chromeos/drive/file_system/search_operation.cc index e5d2497..ea4a63a 100644 --- a/chrome/browser/chromeos/drive/file_system/search_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/search_operation.cc @@ -137,7 +137,7 @@ void SearchOperation::SearchAfterGetResourceList( std::vector<SearchResultInfo>* result_ptr = result.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&RefreshEntriesOnBlockingPool, metadata_, diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation.cc b/chrome/browser/chromeos/drive/file_system/touch_operation.cc index 87c634b..3226f16 100644 --- a/chrome/browser/chromeos/drive/file_system/touch_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/touch_operation.cc @@ -44,13 +44,18 @@ void TouchOperation::TouchFile(const base::FilePath& file_path, ResourceEntry* entry = new ResourceEntry; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, - base::Unretained(metadata_), file_path, entry), + base::Unretained(metadata_), + file_path, + entry), base::Bind(&TouchOperation::TouchFileAfterGetResourceEntry, weak_ptr_factory_.GetWeakPtr(), - file_path, last_access_time, last_modified_time, callback, + file_path, + last_access_time, + last_modified_time, + callback, base::Owned(entry))); } @@ -94,13 +99,15 @@ void TouchOperation::TouchFileAfterServerTimeStampUpdated( } base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&internal::ResourceMetadata::RefreshEntry, base::Unretained(metadata_), ConvertToResourceEntry(*resource_entry)), base::Bind(&TouchOperation::TouchFileAfterRefreshMetadata, - weak_ptr_factory_.GetWeakPtr(), file_path, callback)); + weak_ptr_factory_.GetWeakPtr(), + file_path, + callback)); } void TouchOperation::TouchFileAfterRefreshMetadata( diff --git a/chrome/browser/chromeos/drive/file_system/update_operation.cc b/chrome/browser/chromeos/drive/file_system/update_operation.cc index cf917e4..af789ad2 100644 --- a/chrome/browser/chromeos/drive/file_system/update_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/update_operation.cc @@ -98,7 +98,7 @@ void UpdateOperation::UpdateFileByResourceId( base::FilePath* drive_file_path = new base::FilePath; base::FilePath* cache_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&GetFileLocalState, metadata_, @@ -158,7 +158,7 @@ void UpdateOperation::UpdateFileAfterUpload( base::FilePath* drive_file_path = new base::FilePath; base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&UpdateFileLocalState, metadata_, diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc index 12ad415..f767fd0 100644 --- a/chrome/browser/chromeos/drive/file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_unittest.cc @@ -88,7 +88,7 @@ class FileSystemTest : public testing::Test { pool->GetSequencedTaskRunner(pool->GetSequenceToken()); cache_.reset(new internal::FileCache(util::GetCacheRootPath(profile_.get()), - blocking_task_runner_, + blocking_task_runner_.get(), fake_free_disk_space_getter_.get())); mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); @@ -112,7 +112,7 @@ class FileSystemTest : public testing::Test { fake_drive_service_.get(), scheduler_.get(), resource_metadata_.get(), - blocking_task_runner_)); + blocking_task_runner_.get())); file_system_->AddObserver(mock_directory_observer_.get()); file_system_->Initialize(); diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc index 45f21f6..1734b7a 100644 --- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc @@ -98,7 +98,7 @@ TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) { scoped_refptr<fileapi::FileSystemContext> context( new fileapi::FileSystemContext( fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), - mount_points, + mount_points.get(), NULL, // special_storage_policy NULL, // quota_manager_proxy, ScopedVector<fileapi::FileSystemMountPointProvider>(), diff --git a/chrome/browser/chromeos/drive/local_file_reader.cc b/chrome/browser/chromeos/drive/local_file_reader.cc index 08cb382..5b9b016 100644 --- a/chrome/browser/chromeos/drive/local_file_reader.cc +++ b/chrome/browser/chromeos/drive/local_file_reader.cc @@ -117,7 +117,7 @@ LocalFileReader::LocalFileReader( : sequenced_task_runner_(sequenced_task_runner), platform_file_(base::kInvalidPlatformFileValue), weak_ptr_factory_(this) { - DCHECK(sequenced_task_runner_); + DCHECK(sequenced_task_runner_.get()); } LocalFileReader::~LocalFileReader() { @@ -131,15 +131,16 @@ void LocalFileReader::Open(const base::FilePath& file_path, DCHECK_EQ(base::kInvalidPlatformFileValue, platform_file_); ScopedPlatformFile* platform_file = - new ScopedPlatformFile(sequenced_task_runner_); + new ScopedPlatformFile(sequenced_task_runner_.get()); base::PostTaskAndReplyWithResult( - sequenced_task_runner_, + sequenced_task_runner_.get(), FROM_HERE, - base::Bind(&OpenAndSeekOnBlockingPool, - file_path, offset, platform_file->ptr()), + base::Bind( + &OpenAndSeekOnBlockingPool, file_path, offset, platform_file->ptr()), base::Bind(&LocalFileReader::OpenAfterBlockingPoolTask, weak_ptr_factory_.GetWeakPtr(), - callback, base::Owned(platform_file))); + callback, + base::Owned(platform_file))); } void LocalFileReader::Read(net::IOBuffer* in_buffer, @@ -150,7 +151,7 @@ void LocalFileReader::Read(net::IOBuffer* in_buffer, scoped_refptr<net::IOBuffer> buffer(in_buffer); base::PostTaskAndReplyWithResult( - sequenced_task_runner_, + sequenced_task_runner_.get(), FROM_HERE, base::Bind(&ReadOnBlockingPool, platform_file_, buffer, buffer_length), callback); diff --git a/chrome/browser/chromeos/drive/resource_metadata.cc b/chrome/browser/chromeos/drive/resource_metadata.cc index fd33c46..e62d655 100644 --- a/chrome/browser/chromeos/drive/resource_metadata.cc +++ b/chrome/browser/chromeos/drive/resource_metadata.cc @@ -139,7 +139,7 @@ void ResourceMetadata::Initialize(const FileOperationCallback& callback) { DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::InitializeOnBlockingPool, base::Unretained(this)), @@ -161,10 +161,9 @@ void ResourceMetadata::ResetOnUIThread(const FileOperationCallback& callback) { DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, - base::Bind(&ResourceMetadata::Reset, - base::Unretained(this)), + base::Bind(&ResourceMetadata::Reset, base::Unretained(this)), callback); } @@ -232,7 +231,7 @@ void ResourceMetadata::GetLargestChangestampOnUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::GetLargestChangestamp, base::Unretained(this)), @@ -245,7 +244,7 @@ void ResourceMetadata::SetLargestChangestampOnUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::SetLargestChangestamp, base::Unretained(this), @@ -273,11 +272,10 @@ void ResourceMetadata::AddEntryOnUIThread(const ResourceEntry& entry, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - PostFileMoveTask(blocking_task_runner_, - base::Bind(&AddEntryWithFilePath, - base::Unretained(this), - entry), - callback); + PostFileMoveTask( + blocking_task_runner_.get(), + base::Bind(&AddEntryWithFilePath, base::Unretained(this), entry), + callback); } FileError ResourceMetadata::AddEntry(const ResourceEntry& entry) { @@ -309,7 +307,7 @@ void ResourceMetadata::MoveEntryToDirectoryOnUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - PostFileMoveTask(blocking_task_runner_, + PostFileMoveTask(blocking_task_runner_.get(), base::Bind(&ResourceMetadata::MoveEntryToDirectory, base::Unretained(this), file_path, @@ -323,7 +321,7 @@ void ResourceMetadata::RenameEntryOnUIThread(const base::FilePath& file_path, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - PostFileMoveTask(blocking_task_runner_, + PostFileMoveTask(blocking_task_runner_.get(), base::Bind(&ResourceMetadata::RenameEntry, base::Unretained(this), file_path, @@ -359,15 +357,13 @@ void ResourceMetadata::GetResourceEntryByIdOnUIThread( scoped_ptr<ResourceEntry> entry(new ResourceEntry); ResourceEntry* entry_ptr = entry.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::GetResourceEntryById, base::Unretained(this), resource_id, entry_ptr), - base::Bind(&RunGetResourceEntryCallback, - callback, - base::Passed(&entry))); + base::Bind(&RunGetResourceEntryCallback, callback, base::Passed(&entry))); } FileError ResourceMetadata::GetResourceEntryById( @@ -394,15 +390,13 @@ void ResourceMetadata::GetResourceEntryByPathOnUIThread( scoped_ptr<ResourceEntry> entry(new ResourceEntry); ResourceEntry* entry_ptr = entry.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::GetResourceEntryByPath, base::Unretained(this), file_path, entry_ptr), - base::Bind(&RunGetResourceEntryCallback, - callback, - base::Passed(&entry))); + base::Bind(&RunGetResourceEntryCallback, callback, base::Passed(&entry))); } FileError ResourceMetadata::GetResourceEntryByPath(const base::FilePath& path, @@ -427,15 +421,13 @@ void ResourceMetadata::ReadDirectoryByPathOnUIThread( scoped_ptr<ResourceEntryVector> entries(new ResourceEntryVector); ResourceEntryVector* entries_ptr = entries.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_, + blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::ReadDirectoryByPath, base::Unretained(this), file_path, entries_ptr), - base::Bind(&RunReadDirectoryCallback, - callback, - base::Passed(&entries))); + base::Bind(&RunReadDirectoryCallback, callback, base::Passed(&entries))); } FileError ResourceMetadata::ReadDirectoryByPath( @@ -501,7 +493,7 @@ void ResourceMetadata::RefreshDirectoryOnUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - PostFileMoveTask(blocking_task_runner_, + PostFileMoveTask(blocking_task_runner_.get(), base::Bind(&ResourceMetadata::RefreshDirectory, base::Unretained(this), directory_fetch_info, diff --git a/chrome/browser/chromeos/drive/search_metadata.cc b/chrome/browser/chromeos/drive/search_metadata.cc index d2007a5..9df8abb 100644 --- a/chrome/browser/chromeos/drive/search_metadata.cc +++ b/chrome/browser/chromeos/drive/search_metadata.cc @@ -198,16 +198,15 @@ void SearchMetadata( // TODO(hashimoto): Report error code from ResourceMetadata::IterateEntries // and stop binding FILE_ERROR_OK to |callback|. - base::PostTaskAndReplyWithResult( - blocking_task_runner, - FROM_HERE, - base::Bind(&SearchMetadataOnBlockingPool, - resource_metadata, - cache, - query, - options, - at_most_num_matches), - base::Bind(callback, FILE_ERROR_OK)); + base::PostTaskAndReplyWithResult(blocking_task_runner.get(), + FROM_HERE, + base::Bind(&SearchMetadataOnBlockingPool, + resource_metadata, + cache, + query, + options, + at_most_num_matches), + base::Bind(callback, FILE_ERROR_OK)); } bool FindAndHighlight(const std::string& text, diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc index e0724aa..905323c 100644 --- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc @@ -76,7 +76,7 @@ class SearchMetadataTest : public testing::Test { blocking_task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); cache_.reset(new internal::FileCache(temp_dir_.path(), - blocking_task_runner_, + blocking_task_runner_.get(), fake_free_disk_space_getter_.get())); bool success = false; diff --git a/chrome/browser/chromeos/extensions/echo_private_apitest.cc b/chrome/browser/chromeos/extensions/echo_private_apitest.cc index ad9800c..4a6b1b3 100644 --- a/chrome/browser/chromeos/extensions/echo_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/echo_private_apitest.cc @@ -49,7 +49,7 @@ class ExtensionEchoPrivateApiTest : public ExtensionApiTest { function->set_has_callback(true); scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( - function, + function.get(), "[{\"serviceName\":\"some_name\",\"origin\":\"http://chromium.org\"}]", browser())); diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc index 4a9c082..556f12a 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc @@ -165,7 +165,7 @@ FileSelectorImpl::~FileSelectorImpl() { if (dialog_.get()) dialog_->ListenerDestroyed(); // Send response if needed. - if (function_) + if (function_.get()) SendResponse(false, base::FilePath()); } diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc index a4242a7..2dfa3d2 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc @@ -1096,7 +1096,8 @@ bool SetDefaultTaskFileBrowserFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - std::set<std::string> suffixes = GetUniqueSuffixes(file_url_list, context); + std::set<std::string> suffixes = + GetUniqueSuffixes(file_url_list, context.get()); // MIME types are an optional parameter. base::ListValue* mime_type_list; diff --git a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc index 6ccefe5..b738ce0 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc @@ -713,7 +713,7 @@ class ExtensionTaskExecutor::ExecuteTasksFileSystemCallbackDispatcher { handler_pid_(handler_pid), action_id_(action_id), urls_(file_urls) { - DCHECK(executor_); + DCHECK(executor_.get()); } // Checks legitimacy of file url and grants file RO access permissions from @@ -796,12 +796,12 @@ bool ExtensionTaskExecutor::ExecuteAndNotify( return false; // Forbid calling undeclared handlers. - if (!FindFileBrowserHandler(extension, action_id_)) + if (!FindFileBrowserHandler(extension.get(), action_id_)) return false; int extension_pid = ExtractProcessFromExtensionId(profile(), extension->id()); if (extension_pid <= 0) { - if (!extensions::BackgroundInfo::HasLazyBackgroundPage(extension)) + if (!extensions::BackgroundInfo::HasLazyBackgroundPage(extension.get())) return false; } diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc index fe8d1b2..b088243 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc @@ -75,7 +75,7 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandler) { ASSERT_TRUE(extension.get()); FileBrowserHandler::List* handlers = - FileBrowserHandler::GetHandlers(extension); + FileBrowserHandler::GetHandlers(extension.get()); ASSERT_TRUE(handlers != NULL); ASSERT_EQ(handlers->size(), 1U); const FileBrowserHandler* action = handlers->at(0).get(); @@ -111,7 +111,7 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) { ASSERT_TRUE(extension.get()); FileBrowserHandler::List* handlers = - FileBrowserHandler::GetHandlers(extension); + FileBrowserHandler::GetHandlers(extension.get()); ASSERT_TRUE(handlers != NULL); ASSERT_EQ(handlers->size(), 1U); const FileBrowserHandler* action = handlers->at(0).get(); @@ -142,7 +142,7 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerWithCreate) { ASSERT_TRUE(extension.get()); FileBrowserHandler::List* handlers = - FileBrowserHandler::GetHandlers(extension); + FileBrowserHandler::GetHandlers(extension.get()); ASSERT_TRUE(handlers != NULL); ASSERT_EQ(handlers->size(), 1U); const FileBrowserHandler* action = handlers->at(0).get(); diff --git a/chrome/browser/chromeos/imageburner/burn_manager.cc b/chrome/browser/chromeos/imageburner/burn_manager.cc index d7c39f8..9630131 100644 --- a/chrome/browser/chromeos/imageburner/burn_manager.cc +++ b/chrome/browser/chromeos/imageburner/burn_manager.cc @@ -368,7 +368,7 @@ void BurnManager::FetchConfigFile() { config_fetcher_.reset(net::URLFetcher::Create( config_file_url_, net::URLFetcher::GET, this)); - config_fetcher_->SetRequestContext(url_request_context_getter_); + config_fetcher_->SetRequestContext(url_request_context_getter_.get()); config_fetcher_->Start(); } @@ -388,7 +388,7 @@ void BurnManager::FetchImage() { image_fetcher_.reset(net::URLFetcher::Create(image_download_url_, net::URLFetcher::GET, this)); - image_fetcher_->SetRequestContext(url_request_context_getter_); + image_fetcher_->SetRequestContext(url_request_context_getter_.get()); image_fetcher_->SaveResponseToFileAtPath( zip_image_file_path_, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc index d9ace4b..000287a 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc @@ -100,7 +100,7 @@ void ScreensaverUnpackerClient::LoadScreensaverExtension( extensions::Manifest::COMPONENT, Extension::NO_FLAGS, &error); - if (!screensaver_extension) { + if (!screensaver_extension.get()) { LOG(ERROR) << "Could not load screensaver extension from: " << screensaver_extension_path.value() << " due to: " << error; NotifyAppPackOfDamagedFile(); @@ -221,10 +221,10 @@ void KioskModeScreensaver::SetupScreensaver( Profile* default_profile = ProfileManager::GetDefaultProfile(); // Add the extension to the extension service and display the screensaver. if (default_profile) { - extensions::ExtensionSystem::Get(default_profile)->extension_service()-> - AddExtension(extension); + extensions::ExtensionSystem::Get(default_profile)->extension_service() + ->AddExtension(extension.get()); ash::ShowScreensaver( - extensions::AppLaunchInfo::GetFullLaunchURL(extension)); + extensions::AppLaunchInfo::GetFullLaunchURL(extension.get())); } else { LOG(ERROR) << "Couldn't get default profile. Unable to load screensaver!"; ShutdownKioskModeScreensaver(); diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc index ee7a2ba..7fc1a9a 100644 --- a/chrome/browser/chromeos/login/login_performer.cc +++ b/chrome/browser/chromeos/login/login_performer.cc @@ -69,7 +69,7 @@ LoginPerformer::~LoginPerformer() { DVLOG(1) << "Deleting LoginPerformer"; DCHECK(default_performer_ != NULL) << "Default instance should exist."; default_performer_ = NULL; - if (authenticator_) + if (authenticator_.get()) authenticator_->SetConsumer(NULL); } diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index b965636..1006b08 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -498,7 +498,7 @@ void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) { void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, bool restore_from_auth_cookies) { - CHECK((authenticator_ && authenticator_->authentication_profile()) || + CHECK((authenticator_.get() && authenticator_->authentication_profile()) || !restore_from_auth_cookies); if (!login_manager_.get()) return; @@ -514,9 +514,9 @@ void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, // all other tokens and user_context. login_manager_->RestoreSession( user_profile, - authenticator_ && authenticator_->authentication_profile() ? - authenticator_->authentication_profile()->GetRequestContext() : - NULL, + authenticator_.get() && authenticator_->authentication_profile() + ? authenticator_->authentication_profile()->GetRequestContext() + : NULL, session_restore_strategy_, oauth2_refresh_token_, user_context_.auth_code); @@ -722,12 +722,12 @@ scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( LoginStatusConsumer* consumer) { // Screen locker needs new Authenticator instance each time. if (ScreenLocker::default_screen_locker()) { - if (authenticator_) + if (authenticator_.get()) authenticator_->SetConsumer(NULL); authenticator_ = NULL; } - if (authenticator_ == NULL) { + if (authenticator_.get() == NULL) { authenticator_ = new ParallelAuthenticator(consumer); } else { // TODO(nkostylev): Fix this hack by improving Authenticator dependencies. diff --git a/chrome/browser/chromeos/login/oauth2_login_manager.cc b/chrome/browser/chromeos/login/oauth2_login_manager.cc index 11d39c6..e253754 100644 --- a/chrome/browser/chromeos/login/oauth2_login_manager.cc +++ b/chrome/browser/chromeos/login/oauth2_login_manager.cc @@ -141,7 +141,7 @@ void OAuth2LoginManager::FetchOAuth2Tokens() { // SID/LSID cookies through OAuthLogin call. if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { oauth2_token_fetcher_.reset( - new OAuth2TokenFetcher(this, auth_request_context_)); + new OAuth2TokenFetcher(this, auth_request_context_.get())); oauth2_token_fetcher_->StartExchangeFromCookies(); } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { DCHECK(!auth_code_.empty()); diff --git a/chrome/browser/chromeos/login/oauth2_login_verifier.cc b/chrome/browser/chromeos/login/oauth2_login_verifier.cc index 25f19ae..ad31626 100644 --- a/chrome/browser/chromeos/login/oauth2_login_verifier.cc +++ b/chrome/browser/chromeos/login/oauth2_login_verifier.cc @@ -74,12 +74,13 @@ void OAuth2LoginVerifier::StartFetchingOAuthLoginAccessToken() { gaia_token_.clear(); std::vector<std::string> scopes; scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); - token_fetcher_.reset(new OAuth2AccessTokenFetcher( - this, system_request_context_)), - token_fetcher_->Start(GaiaUrls::GetInstance()->oauth2_chrome_client_id(), - GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), - refresh_token_, - scopes); + token_fetcher_ + .reset(new OAuth2AccessTokenFetcher(this, system_request_context_.get())), + token_fetcher_ + ->Start(GaiaUrls::GetInstance()->oauth2_chrome_client_id(), + GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), + refresh_token_, + scopes); } void OAuth2LoginVerifier::OnGetTokenSuccess( @@ -105,9 +106,10 @@ void OAuth2LoginVerifier::OnGetTokenFailure( void OAuth2LoginVerifier::StartOAuthLoginForUberToken() { // No service will fetch us uber auth token. - gaia_system_fetcher_.reset(new GaiaAuthFetcher( - this, std::string(GaiaConstants::kChromeOSSource), - system_request_context_)); + gaia_system_fetcher_.reset( + new GaiaAuthFetcher(this, + std::string(GaiaConstants::kChromeOSSource), + system_request_context_.get())); gaia_system_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); } @@ -134,9 +136,10 @@ void OAuth2LoginVerifier::OnUberAuthTokenFailure( void OAuth2LoginVerifier::StartOAuthLoginForGaiaCredentials() { // No service will fetch us uber auth token. - gaia_system_fetcher_.reset(new GaiaAuthFetcher( - this, std::string(GaiaConstants::kChromeOSSource), - system_request_context_)); + gaia_system_fetcher_.reset( + new GaiaAuthFetcher(this, + std::string(GaiaConstants::kChromeOSSource), + system_request_context_.get())); gaia_system_fetcher_->StartOAuthLogin(access_token_, EmptyString()); } @@ -163,9 +166,10 @@ void OAuth2LoginVerifier::OnClientLoginFailure( void OAuth2LoginVerifier::StartMergeSession() { DCHECK(!gaia_token_.empty()); - gaia_fetcher_.reset(new GaiaAuthFetcher( - this, std::string(GaiaConstants::kChromeOSSource), - user_request_context_)); + gaia_fetcher_.reset( + new GaiaAuthFetcher(this, + std::string(GaiaConstants::kChromeOSSource), + user_request_context_.get())); gaia_fetcher_->StartMergeSession(gaia_token_); } diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index d15bb1d..be05b21 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -234,7 +234,7 @@ TEST_F(ParallelAuthenticatorTest, OnLoginSuccess) { .Times(1) .RetiresOnSaturation(); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->OnLoginSuccess(false); } @@ -242,13 +242,13 @@ TEST_F(ParallelAuthenticatorTest, OnPasswordChangeDetected) { EXPECT_CALL(consumer_, OnPasswordChangeDetected()) .Times(1) .RetiresOnSaturation(); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->OnPasswordChangeDetected(); } TEST_F(ParallelAuthenticatorTest, ResolveNothingDone) { EXPECT_EQ(ParallelAuthenticator::CONTINUE, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolvePossiblePwChange) { @@ -260,7 +260,7 @@ TEST_F(ParallelAuthenticatorTest, ResolvePossiblePwChange) { state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); EXPECT_EQ(ParallelAuthenticator::POSSIBLE_PW_CHANGE, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolvePossiblePwChangeToFailedMount) { @@ -270,7 +270,7 @@ TEST_F(ParallelAuthenticatorTest, ResolvePossiblePwChangeToFailedMount) { // When there is no online attempt and online results, POSSIBLE_PW_CHANGE EXPECT_EQ(ParallelAuthenticator::FAILED_MOUNT, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveNeedOldPw) { @@ -281,7 +281,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveNeedOldPw) { state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); EXPECT_EQ(ParallelAuthenticator::NEED_OLD_PW, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededDirectFailedMount) { @@ -294,7 +294,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededDirectFailedMount) { SetOwnerState(true, false); EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededMount) { @@ -315,7 +315,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededMount) { false)); state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { @@ -346,7 +346,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); EXPECT_EQ(ParallelAuthenticator::CONTINUE, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); // Let the owner verification run. device_settings_test_helper_.Flush(); // and test that the mount has succeeded. @@ -360,7 +360,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { false)); state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); EXPECT_TRUE( CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); @@ -375,7 +375,7 @@ TEST_F(ParallelAuthenticatorTest, DriveFailedMount) { // Set up state as though a cryptohome mount attempt has occurred // and failed. state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_NONE); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } @@ -463,7 +463,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataResync) { .RetiresOnSaturation(); state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->ResyncEncryptedData(); message_loop_.Run(); @@ -479,7 +479,7 @@ TEST_F(ParallelAuthenticatorTest, DriveResyncFail) { .Times(1) .RetiresOnSaturation(); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->ResyncEncryptedData(); message_loop_.Run(); @@ -491,7 +491,7 @@ TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) { state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } @@ -520,7 +520,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecover) { .RetiresOnSaturation(); state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->RecoverEncryptedData(std::string()); message_loop_.Run(); @@ -540,7 +540,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) { .WillOnce(Return(std::string())) .RetiresOnSaturation(); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); auth_->RecoverEncryptedData(std::string()); message_loop_.Run(); @@ -556,7 +556,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveNoMount) { cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); EXPECT_EQ(ParallelAuthenticator::NO_MOUNT, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveNoMountToFailedMount) { @@ -568,7 +568,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveNoMountToFailedMount) { // When there is no online attempt and online results, NO_MOUNT will be // resolved to FAILED_MOUNT. EXPECT_EQ(ParallelAuthenticator::FAILED_MOUNT, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) { @@ -580,7 +580,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) { state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); EXPECT_EQ(ParallelAuthenticator::CREATE_NEW, - SetAndResolveState(auth_, state_.release())); + SetAndResolveState(auth_.get(), state_.release())); } TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) { @@ -607,7 +607,7 @@ TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) { state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } @@ -622,7 +622,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) { GoogleServiceAuthError error = GoogleServiceAuthError::FromConnectionError(net::ERR_CONNECTION_RESET); state_->PresetOnlineLoginStatus(LoginFailure::FromNetworkAuthFailure(error)); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } @@ -635,7 +635,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginDelayedOnline) { // succeeded. state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); // state_ is released further down. - SetAttemptState(auth_, state_.get()); + SetAttemptState(auth_.get(), state_.get()); RunResolve(auth_.get()); // Offline login has completed, so now we "complete" the online request. @@ -668,7 +668,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) { // succeeded; also, an online request that never made it. state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); // state_ is released further down. - SetAttemptState(auth_, state_.get()); + SetAttemptState(auth_.get(), state_.get()); RunResolve(auth_.get()); // Offline login has completed, so now we "complete" the online request. @@ -707,7 +707,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) { // succeeded; also, an online request that never made it. state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); // state_ is released further down. - SetAttemptState(auth_, state_.get()); + SetAttemptState(auth_.get(), state_.get()); RunResolve(auth_.get()); // Offline login has completed, so now we "complete" the online request. @@ -748,7 +748,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) { // succeeded. state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } @@ -767,7 +767,7 @@ TEST_F(ParallelAuthenticatorTest, DISABLED_DriveNeedNewPassword) { // succeeded. state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); state_->PresetOnlineLoginStatus(failure); - SetAttemptState(auth_, state_.release()); + SetAttemptState(auth_.get(), state_.release()); RunResolve(auth_.get()); } diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 44248e6..263c7ca 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -399,7 +399,7 @@ ScreenLocker::~ScreenLocker() { VLOG(1) << "Destroying ScreenLocker " << this; DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); - if (authenticator_) + if (authenticator_.get()) authenticator_->SetConsumer(NULL); ClearErrors(); diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc index 5c5fdcb..22b47d6 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc @@ -77,7 +77,7 @@ class DeviceCloudPolicyManagerChromeOSTest request_context_getter_ = new net::TestURLRequestContextGetter( loop_.message_loop_proxy()); TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( - request_context_getter_); + request_context_getter_.get()); TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); chromeos::CryptohomeLibrary::SetForTest(cryptohome_library_.get()); diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc index 2707f29..3b0d634 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc @@ -35,8 +35,8 @@ void DeviceCloudPolicyStoreChromeOS::Store( scoped_refptr<chromeos::OwnerKey> owner_key( device_settings_service_->GetOwnerKey()); if (!install_attributes_->IsEnterpriseDevice() || - !device_settings_service_->policy_data() || - !owner_key || !owner_key->public_key()) { + !device_settings_service_->policy_data() || !owner_key.get() || + !owner_key->public_key()) { status_ = STATUS_BAD_STATE; NotifyStoreError(); return; diff --git a/chrome/browser/chromeos/policy/policy_cert_verifier_browsertest.cc b/chrome/browser/chromeos/policy/policy_cert_verifier_browsertest.cc index fd440cf..aea0574 100644 --- a/chrome/browser/chromeos/policy/policy_cert_verifier_browsertest.cc +++ b/chrome/browser/chromeos/policy/policy_cert_verifier_browsertest.cc @@ -106,7 +106,7 @@ class PolicyCertVerifierTest : public testing::Test { TEST_F(PolicyCertVerifierTest, VerifyUntrustedCert) { scoped_refptr<net::X509Certificate> cert = LoadCertificate("ok_cert.pem", net::SERVER_CERT); - ASSERT_TRUE(cert); + ASSERT_TRUE(cert.get()); // |cert| is untrusted, so Verify() fails. net::CertVerifyResult verify_result; @@ -114,9 +114,14 @@ TEST_F(PolicyCertVerifierTest, VerifyUntrustedCert) { net::CertVerifier::RequestHandle request_handle; EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(empty_cert_list_)); - int error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + int error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); ASSERT_EQ(net::ERR_IO_PENDING, error); ASSERT_TRUE(request_handle); @@ -127,9 +132,14 @@ TEST_F(PolicyCertVerifierTest, VerifyUntrustedCert) { // path. EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(empty_cert_list_)); - error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); @@ -143,10 +153,10 @@ TEST_F(PolicyCertVerifierTest, VerifyTrustedCert) { // |ca_cert| is the issuer of |cert|. scoped_refptr<net::X509Certificate> ca_cert = LoadCertificate("root_ca_cert.crt", net::CA_CERT); - ASSERT_TRUE(ca_cert); + ASSERT_TRUE(ca_cert.get()); scoped_refptr<net::X509Certificate> cert = LoadCertificate("ok_cert.pem", net::SERVER_CERT); - ASSERT_TRUE(cert); + ASSERT_TRUE(cert.get()); // Make the database trust |ca_cert|. net::CertificateList import_list; @@ -167,9 +177,14 @@ TEST_F(PolicyCertVerifierTest, VerifyTrustedCert) { net::CertVerifier::RequestHandle request_handle; EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(empty_cert_list_)); - int error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + int error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); ASSERT_EQ(net::ERR_IO_PENDING, error); ASSERT_TRUE(request_handle); @@ -192,10 +207,10 @@ TEST_F(PolicyCertVerifierTest, VerifyUsingAdditionalTrustAnchor) { // |ca_cert| is the issuer of |cert|. scoped_refptr<net::X509Certificate> ca_cert = LoadCertificate("root_ca_cert.crt", net::CA_CERT); - ASSERT_TRUE(ca_cert); + ASSERT_TRUE(ca_cert.get()); scoped_refptr<net::X509Certificate> cert = LoadCertificate("ok_cert.pem", net::SERVER_CERT); - ASSERT_TRUE(cert); + ASSERT_TRUE(cert.get()); net::CertificateList additional_trust_anchors; additional_trust_anchors.push_back(ca_cert); @@ -207,9 +222,14 @@ TEST_F(PolicyCertVerifierTest, VerifyUsingAdditionalTrustAnchor) { net::CertVerifier::RequestHandle request_handle; EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(additional_trust_anchors)); - int error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + int error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); ASSERT_EQ(net::ERR_IO_PENDING, error); ASSERT_TRUE(request_handle); @@ -232,10 +252,10 @@ TEST_F(PolicyCertVerifierTest, ProfileRemainsTainted) { // |ca_cert| is the issuer of |cert|. scoped_refptr<net::X509Certificate> ca_cert = LoadCertificate("root_ca_cert.crt", net::CA_CERT); - ASSERT_TRUE(ca_cert); + ASSERT_TRUE(ca_cert.get()); scoped_refptr<net::X509Certificate> cert = LoadCertificate("ok_cert.pem", net::SERVER_CERT); - ASSERT_TRUE(cert); + ASSERT_TRUE(cert.get()); net::CertificateList additional_trust_anchors; additional_trust_anchors.push_back(ca_cert); @@ -246,9 +266,14 @@ TEST_F(PolicyCertVerifierTest, ProfileRemainsTainted) { net::CertVerifier::RequestHandle request_handle; EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(empty_cert_list_)); - int error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + int error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); ASSERT_EQ(net::ERR_IO_PENDING, error); ASSERT_TRUE(request_handle); @@ -263,9 +288,14 @@ TEST_F(PolicyCertVerifierTest, ProfileRemainsTainted) { // Verify() again with the additional trust anchors. EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(additional_trust_anchors)); - error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); ASSERT_EQ(net::ERR_IO_PENDING, error); ASSERT_TRUE(request_handle); @@ -281,9 +311,14 @@ TEST_F(PolicyCertVerifierTest, ProfileRemainsTainted) { // Verifying after removing the trust anchors should now fail. EXPECT_CALL(trust_provider_, GetAdditionalTrustAnchors()) .WillOnce(ReturnRef(empty_cert_list_)); - error = cert_verifier_->Verify(cert, "127.0.0.1", 0, NULL, - &verify_result, callback.callback(), - &request_handle, net::BoundNetLog()); + error = cert_verifier_->Verify(cert.get(), + "127.0.0.1", + 0, + NULL, + &verify_result, + callback.callback(), + &request_handle, + net::BoundNetLog()); Mock::VerifyAndClearExpectations(&trust_provider_); // Note: this hits the cached result from the first Verify() in this test. EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); diff --git a/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc b/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc index 7d89c53..1a40b39 100644 --- a/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc +++ b/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc @@ -63,10 +63,8 @@ void PolicyOAuth2TokenFetcher::Start() { } void PolicyOAuth2TokenFetcher::StartFetchingRefreshToken() { - refresh_token_fetcher_.reset( - new GaiaAuthFetcher(this, - GaiaConstants::kChromeSource, - auth_context_getter_)); + refresh_token_fetcher_.reset(new GaiaAuthFetcher( + this, GaiaConstants::kChromeSource, auth_context_getter_.get())); refresh_token_fetcher_->StartCookieForOAuthLoginTokenExchange(EmptyString()); } @@ -74,7 +72,7 @@ void PolicyOAuth2TokenFetcher::StartFetchingAccessToken() { std::vector<std::string> scopes; scopes.push_back(GaiaConstants::kDeviceManagementServiceOAuth); access_token_fetcher_.reset( - new OAuth2AccessTokenFetcher(this, system_context_getter_)); + new OAuth2AccessTokenFetcher(this, system_context_getter_.get())); access_token_fetcher_->Start( GaiaUrls::GetInstance()->oauth2_chrome_client_id(), GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc index fb01ed1..f08c1a0 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc @@ -196,14 +196,14 @@ void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingSigninProfile() { Profile* signin_profile = chromeos::ProfileHelper::GetSigninProfile(); if (signin_profile) signin_context = signin_profile->GetRequestContext(); - if (!signin_context) { + if (!signin_context.get()) { LOG(ERROR) << "No signin Profile for policy oauth token fetch!"; OnOAuth2PolicyTokenFetched(std::string()); return; } token_fetcher_.reset(new PolicyOAuth2TokenFetcher( - signin_context, + signin_context.get(), g_browser_process->system_request_context(), base::Bind(&UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched, base::Unretained(this)))); diff --git a/chrome/browser/chromeos/power/peripheral_battery_observer.cc b/chrome/browser/chromeos/power/peripheral_battery_observer.cc index 3dc046d..9af1690 100644 --- a/chrome/browser/chromeos/power/peripheral_battery_observer.cc +++ b/chrome/browser/chromeos/power/peripheral_battery_observer.cc @@ -180,7 +180,7 @@ void PeripheralBatteryObserver::DeviceRemoved(device::BluetoothAdapter* adapter, void PeripheralBatteryObserver::InitializeOnBluetoothReady( scoped_refptr<device::BluetoothAdapter> adapter) { bluetooth_adapter_ = adapter; - CHECK(bluetooth_adapter_); + CHECK(bluetooth_adapter_.get()); bluetooth_adapter_->AddObserver(this); } diff --git a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc index c9e547a..17baf41 100644 --- a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc +++ b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc @@ -52,7 +52,7 @@ class ScreensaverControllerTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, Basic) { scoped_refptr<extensions::Extension> extension( CreateTestScreensaverExtension()); - InstallExtensionToDefaultProfile(extension); + InstallExtensionToDefaultProfile(extension.get()); scoped_ptr<ScreensaverController> controller_; controller_.reset(new ScreensaverController()); @@ -70,7 +70,7 @@ IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, Basic) { IN_PROC_BROWSER_TEST_F(ScreensaverControllerTest, OutOfOrder) { scoped_refptr<extensions::Extension> extension( CreateTestScreensaverExtension()); - InstallExtensionToDefaultProfile(extension); + InstallExtensionToDefaultProfile(extension.get()); scoped_ptr<ScreensaverController> controller_; controller_.reset(new ScreensaverController()); diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index c5defb1..f3507c1 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -326,7 +326,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, void InitializeOnAdapterReady( scoped_refptr<device::BluetoothAdapter> adapter) { bluetooth_adapter_ = adapter; - CHECK(bluetooth_adapter_); + CHECK(bluetooth_adapter_.get()); bluetooth_adapter_->AddObserver(this); local_state_registrar_.reset(new PrefChangeRegistrar); diff --git a/chrome/browser/chromeos/web_socket_proxy.cc b/chrome/browser/chromeos/web_socket_proxy.cc index 743da0a..13d36e7 100644 --- a/chrome/browser/chromeos/web_socket_proxy.cc +++ b/chrome/browser/chromeos/web_socket_proxy.cc @@ -461,7 +461,7 @@ class SSLChan : public base::MessageLoopForIO::Watcher { public: DerivedIOBufferWithSize(net::IOBuffer* host, int size) : IOBufferWithSize(host->data(), size), host_(host) { - DCHECK(host_); + DCHECK(host_.get()); DCHECK(host_->data()); } @@ -483,11 +483,11 @@ class SSLChan : public base::MessageLoopForIO::Watcher { // Obtains IOBuffer to add new data to back. net::IOBufferWithSize* GetIOBufferToFill() { - if (back_ == NULL) { + if (back_.get() == NULL) { if (storage_.size() >= kNumBuffersLimit) return NULL; storage_.push_back(new net::IOBufferWithSize(buf_size_)); - back_ = new net::DrainableIOBuffer(storage_.back(), buf_size_); + back_ = new net::DrainableIOBuffer(storage_.back().get(), buf_size_); } return new DerivedIOBufferWithSize( back_.get(), back_->BytesRemaining()); @@ -495,20 +495,21 @@ class SSLChan : public base::MessageLoopForIO::Watcher { // Obtains IOBuffer with some data from front. net::IOBufferWithSize* GetIOBufferToProcess() { - if (front_ == NULL) { + if (front_.get() == NULL) { if (storage_.empty()) return NULL; - front_ = new net::DrainableIOBuffer(storage_.front(), buf_size_); + front_ = new net::DrainableIOBuffer(storage_.front().get(), buf_size_); } - int front_capacity = (storage_.size() == 1 && back_) ? - back_->BytesConsumed() : buf_size_; + int front_capacity = + (storage_.size() == 1 && back_.get()) ? back_->BytesConsumed() + : buf_size_; return new DerivedIOBufferWithSize( front_.get(), front_capacity - front_->BytesConsumed()); } // Records number of bytes as added to back. void DidFill(int bytes) { - DCHECK(back_); + DCHECK(back_.get()); back_->DidConsume(bytes); if (back_->BytesRemaining() == 0) back_ = NULL; @@ -516,7 +517,7 @@ class SSLChan : public base::MessageLoopForIO::Watcher { // Pops number of bytes from front. void DidProcess(int bytes) { - DCHECK(front_); + DCHECK(front_.get()); front_->DidConsume(bytes); if (front_->BytesRemaining() == 0) { storage_.pop_front(); @@ -585,7 +586,7 @@ class SSLChan : public base::MessageLoopForIO::Watcher { inbound_stream_.GetIOBufferToProcess() }; for (int i = arraysize(buf); i--;) { - if (buf[i] && buf[i]->size() > 0) { + if (buf[i].get() && buf[i]->size() > 0) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SSLChan::Proceed, weak_factory_.GetWeakPtr())); @@ -704,7 +705,7 @@ class SSLChan : public base::MessageLoopForIO::Watcher { if (!is_read_pipe_blocked_ && phase_ == PHASE_RUNNING) { scoped_refptr<net::IOBufferWithSize> buf = outbound_stream_.GetIOBufferToFill(); - if (buf && buf->size() > 0) { + if (buf.get() && buf->size() > 0) { int rv = read(read_pipe_, buf->data(), buf->size()); if (rv > 0) { outbound_stream_.DidFill(rv); @@ -726,9 +727,10 @@ class SSLChan : public base::MessageLoopForIO::Watcher { if (!is_socket_read_pending_ && phase_ == PHASE_RUNNING) { scoped_refptr<net::IOBufferWithSize> buf = inbound_stream_.GetIOBufferToFill(); - if (buf && buf->size() > 0) { + if (buf.get() && buf->size() > 0) { int rv = socket_->Read( - buf, buf->size(), + buf.get(), + buf->size(), base::Bind(&SSLChan::OnSocketRead, base::Unretained(this))); is_socket_read_pending_ = true; if (rv != net::ERR_IO_PENDING) { @@ -741,9 +743,10 @@ class SSLChan : public base::MessageLoopForIO::Watcher { if (!is_socket_write_pending_) { scoped_refptr<net::IOBufferWithSize> buf = outbound_stream_.GetIOBufferToProcess(); - if (buf && buf->size() > 0) { + if (buf.get() && buf->size() > 0) { int rv = socket_->Write( - buf, buf->size(), + buf.get(), + buf->size(), base::Bind(&SSLChan::OnSocketWrite, base::Unretained(this))); is_socket_write_pending_ = true; if (rv != net::ERR_IO_PENDING) { @@ -758,7 +761,7 @@ class SSLChan : public base::MessageLoopForIO::Watcher { if (!is_write_pipe_blocked_) { scoped_refptr<net::IOBufferWithSize> buf = inbound_stream_.GetIOBufferToProcess(); - if (buf && buf->size() > 0) { + if (buf.get() && buf->size() > 0) { int rv = write(write_pipe_, buf->data(), buf->size()); if (rv > 0) { inbound_stream_.DidProcess(rv); diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 4f396e3..c6563fd 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -1263,7 +1263,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { // We don't parse the plugins section on Chrome OS. #if defined(OS_CHROMEOS) - EXPECT_TRUE(!extensions::PluginInfo::HasPlugins(loaded_[1])); + EXPECT_TRUE(!extensions::PluginInfo::HasPlugins(loaded_[1].get())); #else ASSERT_TRUE(extensions::PluginInfo::HasPlugins(loaded_[1].get())); const std::vector<extensions::PluginInfo>* plugins = diff --git a/chrome/browser/google/google_util_chromeos.cc b/chrome/browser/google/google_util_chromeos.cc index fc265d1..b39d910 100644 --- a/chrome/browser/google/google_util_chromeos.cc +++ b/chrome/browser/google/google_util_chromeos.cc @@ -64,7 +64,7 @@ std::string GetBrand() { void SetBrandFromFile(const base::Closure& callback) { base::PostTaskAndReplyWithResult( - base::WorkerPool::GetTaskRunner(false /* task_is_slow */), + base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), FROM_HERE, base::Bind(&ReadBrandFromFile), base::Bind(&SetBrand, callback)); diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index 7356d62..2e16c0e 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -325,9 +325,9 @@ UserAffiliation BrowserPolicyConnector::GetUserAffiliation( #if defined(OS_CHROMEOS) AppPackUpdater* BrowserPolicyConnector::GetAppPackUpdater() { // request_context_ is NULL in unit tests. - if (!app_pack_updater_ && request_context_) { + if (!app_pack_updater_ && request_context_.get()) { app_pack_updater_.reset( - new AppPackUpdater(request_context_, install_attributes_.get())); + new AppPackUpdater(request_context_.get(), install_attributes_.get())); } return app_pack_updater_.get(); } diff --git a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc index 4748694..a0e0310 100644 --- a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc @@ -243,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(ComponentCloudPolicyTest, InstallNewExtension) { result_listener.AlsoListenForFailureMessage("fail"); scoped_refptr<const extensions::Extension> extension2 = LoadExtension(kTestExtension2Path); - ASSERT_TRUE(extension2); + ASSERT_TRUE(extension2.get()); ASSERT_EQ(kTestExtension2, extension2->id()); // This extension only sends the 'policy' signal once it receives the policy, diff --git a/chrome/browser/ui/app_list/apps_model_builder_unittest.cc b/chrome/browser/ui/app_list/apps_model_builder_unittest.cc index 89b2800..3325db3 100644 --- a/chrome/browser/ui/app_list/apps_model_builder_unittest.cc +++ b/chrome/browser/ui/app_list/apps_model_builder_unittest.cc @@ -104,7 +104,7 @@ TEST_F(AppsModelBuilderTest, HideWebStore) { "0.0", "http://google.com", std::string(extension_misc::kWebStoreAppId)); - service_->AddExtension(store); + service_->AddExtension(store.get()); // Install an "enterprise web store" app. scoped_refptr<extensions::Extension> enterprise_store = @@ -112,7 +112,7 @@ TEST_F(AppsModelBuilderTest, HideWebStore) { "0.0", "http://google.com", std::string(extension_misc::kEnterpriseWebStoreAppId)); - service_->AddExtension(enterprise_store); + service_->AddExtension(enterprise_store.get()); // Web stores should be present in the AppListModel. app_list::AppListModel::Apps model1; diff --git a/chrome/browser/ui/app_list/search/history_unittest.cc b/chrome/browser/ui/app_list/search/history_unittest.cc index 0a55f8d..c498118 100644 --- a/chrome/browser/ui/app_list/search/history_unittest.cc +++ b/chrome/browser/ui/app_list/search/history_unittest.cc @@ -126,9 +126,8 @@ class SearchHistoryTest : public testing::Test { // Replace |data_| with test params. history_->data_->RemoveObserver(history_.get()); - history_->data_.reset(new HistoryData(history_->store_, - kMaxPrimary, - kMaxSecondary)); + history_->data_.reset( + new HistoryData(history_->store_.get(), kMaxPrimary, kMaxSecondary)); history_->data_->AddObserver(history_.get()); HistoryDataLoadWaiter waiter(history_->data_.get()); diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 4791cf9..3a7c275 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -152,10 +152,10 @@ void BrowserActionsContainer::CreateBrowserActionViews() { const extensions::ExtensionList& toolbar_items = model_->toolbar_items(); for (extensions::ExtensionList::const_iterator i(toolbar_items.begin()); i != toolbar_items.end(); ++i) { - if (!ShouldDisplayBrowserAction(*i)) + if (!ShouldDisplayBrowserAction(i->get())) continue; - BrowserActionView* view = new BrowserActionView(*i, browser_, this); + BrowserActionView* view = new BrowserActionView(i->get(), browser_, this); browser_action_views_.push_back(view); AddChildView(view); } diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc index 6621ee9..3efc148 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc @@ -65,7 +65,7 @@ PendingDialog* PendingDialog::GetInstance() { void PendingDialog::Add(int32 tab_id, scoped_refptr<SelectFileDialogExtension> dialog) { - DCHECK(dialog); + DCHECK(dialog.get()); if (map_.find(tab_id) == map_.end()) map_.insert(std::make_pair(tab_id, dialog)); else @@ -109,7 +109,7 @@ SelectFileDialogExtension::SelectFileDialogExtension( } SelectFileDialogExtension::~SelectFileDialogExtension() { - if (extension_dialog_) + if (extension_dialog_.get()) extension_dialog_->ObserverDestroyed(); } @@ -168,7 +168,7 @@ void SelectFileDialogExtension::OnFileSelected( int index) { scoped_refptr<SelectFileDialogExtension> dialog = PendingDialog::GetInstance()->Find(tab_id); - if (!dialog) + if (!dialog.get()) return; dialog->selection_type_ = SINGLE_FILE; dialog->selection_files_.clear(); @@ -182,7 +182,7 @@ void SelectFileDialogExtension::OnMultiFilesSelected( const std::vector<ui::SelectedFileInfo>& files) { scoped_refptr<SelectFileDialogExtension> dialog = PendingDialog::GetInstance()->Find(tab_id); - if (!dialog) + if (!dialog.get()) return; dialog->selection_type_ = MULTIPLE_FILES; dialog->selection_files_ = files; @@ -193,7 +193,7 @@ void SelectFileDialogExtension::OnMultiFilesSelected( void SelectFileDialogExtension::OnFileSelectionCanceled(int32 tab_id) { scoped_refptr<SelectFileDialogExtension> dialog = PendingDialog::GetInstance()->Find(tab_id); - if (!dialog) + if (!dialog.get()) return; dialog->selection_type_ = CANCEL; dialog->selection_files_.clear(); @@ -201,7 +201,7 @@ void SelectFileDialogExtension::OnFileSelectionCanceled(int32 tab_id) { } content::RenderViewHost* SelectFileDialogExtension::GetRenderViewHost() { - if (extension_dialog_) + if (extension_dialog_.get()) return extension_dialog_->host()->render_view_host(); return NULL; } diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc index a4a7029..ae048bb 100644 --- a/chrome/browser/ui/views/simple_message_box_views.cc +++ b/chrome/browser/ui/views/simple_message_box_views.cc @@ -176,7 +176,7 @@ MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, MessageBoxType type) { scoped_refptr<SimpleMessageBoxViews> dialog( new SimpleMessageBoxViews(title, message, type)); - CreateBrowserModalDialogViews(dialog, parent)->Show(); + CreateBrowserModalDialogViews(dialog.get(), parent)->Show(); #if defined(USE_AURA) // Use the widget's window itself so that the message loop @@ -184,8 +184,8 @@ MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, // |Cancel| or |Accept|. aura::Window* anchor = parent ? parent : dialog->GetWidget()->GetNativeWindow(); - aura::client::GetDispatcherClient(anchor->GetRootWindow())-> - RunWithDispatcher(dialog, anchor, true); + aura::client::GetDispatcherClient(anchor->GetRootWindow()) + ->RunWithDispatcher(dialog.get(), anchor, true); #else { base::MessageLoop::ScopedNestableTaskAllower allow( diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc index cbc2b0a..4da3e79 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc @@ -64,7 +64,7 @@ class CertificateSelectorTableModel : public ui::TableModel { CertificateSelectorTableModel::CertificateSelectorTableModel( net::SSLCertRequestInfo* cert_request_info) { for (size_t i = 0; i < cert_request_info->client_certs.size(); ++i) { - net::X509Certificate* cert = cert_request_info->client_certs[i]; + net::X509Certificate* cert = cert_request_info->client_certs[i].get(); string16 text = l10n_util::GetStringFUTF16( IDS_CERT_SELECTOR_TABLE_CERT_FORMAT, UTF8ToUTF16(cert->subject().GetDisplayName()), @@ -161,7 +161,7 @@ net::X509Certificate* SSLClientCertificateSelector::GetSelectedCert() const { if (selected >= 0 && selected < static_cast<int>( cert_request_info()->client_certs.size())) - return cert_request_info()->client_certs[selected]; + return cert_request_info()->client_certs[selected].get(); return NULL; } diff --git a/chrome/browser/ui/webui/certificate_viewer_webui.cc b/chrome/browser/ui/webui/certificate_viewer_webui.cc index 68d7d17..e5dc6d5 100644 --- a/chrome/browser/ui/webui/certificate_viewer_webui.cc +++ b/chrome/browser/ui/webui/certificate_viewer_webui.cc @@ -86,7 +86,7 @@ GURL CertificateViewerDialog::GetDialogContentURL() const { void CertificateViewerDialog::GetWebUIMessageHandlers( std::vector<WebUIMessageHandler*>* handlers) const { - handlers->push_back(new CertificateViewerDialogHandler(window_, cert_)); + handlers->push_back(new CertificateViewerDialogHandler(window_, cert_.get())); } void CertificateViewerDialog::GetDialogSize(gfx::Size* size) const { diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index 955d60a..b32b4ca 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc @@ -79,7 +79,7 @@ bool HandleRequestCallback( !ScreenLocker::default_screen_locker()) { scoped_refptr<base::RefCountedBytes> empty_bytes = new base::RefCountedBytes(); - callback.Run(empty_bytes); + callback.Run(empty_bytes.get()); return true; } diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 5c570e7..c0f6095 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -338,7 +338,7 @@ SigninScreenHandler::SigninScreenHandler( last_network_state_(NetworkStateInformer::UNKNOWN), has_pending_auth_ui_(false), ignore_next_user_abort_frame_error_(false) { - DCHECK(network_state_informer_); + DCHECK(network_state_informer_.get()); DCHECK(error_screen_actor_); network_state_informer_->AddObserver(this); CrosSettings::Get()->AddSettingsObserver(kAccountsPrefAllowNewUser, this); diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index dc548c0..a6c5c9d 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -235,7 +235,7 @@ void MobileSetupUIHTMLSource::StartDataRequest( if (!network || (!network->SupportsActivation() && !network->activated())) { LOG(WARNING) << "Can't find device to activate for service path " << path; scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); - callback.Run(html_bytes); + callback.Run(html_bytes.get()); return; } diff --git a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc index bdb0bcf..3b26378 100644 --- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc @@ -213,7 +213,7 @@ void BluetoothOptionsHandler::InitializePage() { void BluetoothOptionsHandler::InitializeAdapter( scoped_refptr<device::BluetoothAdapter> adapter) { adapter_ = adapter; - CHECK(adapter_); + CHECK(adapter_.get()); adapter_->AddObserver(this); } @@ -514,7 +514,7 @@ void BluetoothOptionsHandler::ConfirmPasskey(device::BluetoothDevice* device, } void BluetoothOptionsHandler::DismissDisplayOrConfirm() { - DCHECK(adapter_); + DCHECK(adapter_.get()); // We can receive this delegate call when we haven't been asked to display or // confirm anything; we can determine that by checking whether we've saved diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc index 7ad5c84..fdd7949 100644 --- a/chromeos/audio/cras_audio_handler.cc +++ b/chromeos/audio/cras_audio_handler.cc @@ -275,7 +275,7 @@ CrasAudioHandler::CrasAudioHandler( has_alternative_output_(false), output_mute_locked_(false), input_mute_locked_(false) { - if (!audio_pref_handler) + if (!audio_pref_handler.get()) return; // If the DBusThreadManager or the CrasAudioClient aren't available, there // isn't much we can do. This should only happen when running tests. @@ -295,7 +295,7 @@ CrasAudioHandler::~CrasAudioHandler() { return; chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> RemoveObserver(this); - if (audio_pref_handler_) + if (audio_pref_handler_.get()) audio_pref_handler_->RemoveAudioPrefObserver(this); audio_pref_handler_ = NULL; } diff --git a/chromeos/dbus/blocking_method_caller_unittest.cc b/chromeos/dbus/blocking_method_caller_unittest.cc index 2abfd64..5102b62 100644 --- a/chromeos/dbus/blocking_method_caller_unittest.cc +++ b/chromeos/dbus/blocking_method_caller_unittest.cc @@ -39,25 +39,24 @@ class BlockingMethodCallerTest : public testing::Test { // Set an expectation so mock_proxy's CallMethodAndBlock() will use // CreateMockProxyResponse() to return responses. - EXPECT_CALL(*mock_proxy_, MockCallMethodAndBlock(_, _)) - .WillRepeatedly(Invoke( - this, &BlockingMethodCallerTest::CreateMockProxyResponse)); + EXPECT_CALL(*mock_proxy_.get(), MockCallMethodAndBlock(_, _)) + .WillRepeatedly( + Invoke(this, &BlockingMethodCallerTest::CreateMockProxyResponse)); // Set an expectation so mock_bus's GetObjectProxy() for the given // service name and the object path will return mock_proxy_. - EXPECT_CALL(*mock_bus_, GetObjectProxy( - "org.chromium.TestService", - dbus::ObjectPath("/org/chromium/TestObject"))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy("org.chromium.TestService", + dbus::ObjectPath("/org/chromium/TestObject"))) .WillOnce(Return(mock_proxy_.get())); // Set an expectation so mock_bus's PostTaskToDBusThread() will run the // given task. - EXPECT_CALL(*mock_bus_, PostTaskToDBusThread(_, _)) - .WillRepeatedly(Invoke( - this, &BlockingMethodCallerTest::RunTask)); + EXPECT_CALL(*mock_bus_.get(), PostTaskToDBusThread(_, _)) + .WillRepeatedly(Invoke(this, &BlockingMethodCallerTest::RunTask)); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); } virtual void TearDown() { diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc index c5c3681..915e4ec 100644 --- a/chromeos/dbus/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks_client.cc @@ -434,11 +434,9 @@ class CrosDisksClientStubImpl : public CrosDisksClient { // Perform fake mount. base::PostTaskAndReplyWithResult( - base::WorkerPool::GetTaskRunner(true /* task_is_slow */), + base::WorkerPool::GetTaskRunner(true /* task_is_slow */).get(), FROM_HERE, - base::Bind(&PerformFakeMount, - source_path, - mounted_path), + base::Bind(&PerformFakeMount, source_path, mounted_path), base::Bind(&CrosDisksClientStubImpl::ContinueMount, weak_ptr_factory_.GetWeakPtr(), source_path, diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index f76edb1..41a576a 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -181,7 +181,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { virtual void InitIBusBus( const std::string &ibus_address, const base::Closure& on_disconnected_callback) OVERRIDE { - DCHECK(!ibus_bus_); + DCHECK(!ibus_bus_.get()); dbus::Bus::Options ibus_bus_options; ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS; ibus_bus_options.address = ibus_address; diff --git a/chromeos/dbus/gsm_sms_client_unittest.cc b/chromeos/dbus/gsm_sms_client_unittest.cc index 6caf93a..0f15271 100644 --- a/chromeos/dbus/gsm_sms_client_unittest.cc +++ b/chromeos/dbus/gsm_sms_client_unittest.cc @@ -82,23 +82,25 @@ class GsmSMSClientTest : public testing::Test { // Set an expectation so mock_proxy's ConnectToSignal() will use // OnConnectToSignal() to run the callback. - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - modemmanager::kModemManagerSMSInterface, - modemmanager::kSMSReceivedSignal, _, _)) + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(modemmanager::kModemManagerSMSInterface, + modemmanager::kSMSReceivedSignal, + _, + _)) .WillRepeatedly(Invoke(this, &GsmSMSClientTest::OnConnectToSignal)); // Set an expectation so mock_bus's GetObjectProxy() for the given // service name and the object path will return mock_proxy_. - EXPECT_CALL(*mock_bus_, GetObjectProxy(kServiceName, - dbus::ObjectPath(kObjectPath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(kServiceName, dbus::ObjectPath(kObjectPath))) .WillOnce(Return(mock_proxy_.get())); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create a client with the mock bus. - client_.reset(GsmSMSClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + client_.reset( + GsmSMSClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, mock_bus_.get())); } virtual void TearDown() OVERRIDE { @@ -221,7 +223,7 @@ TEST_F(GsmSMSClientTest, Delete) { // Set expectations. const uint32 kIndex = 42; expected_index_ = kIndex; - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillOnce(Invoke(this, &GsmSMSClientTest::OnDelete)); MockDeleteCallback callback; EXPECT_CALL(callback, Run()).Times(1); @@ -241,7 +243,7 @@ TEST_F(GsmSMSClientTest, Get) { // Set expectations. const uint32 kIndex = 42; expected_index_ = kIndex; - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillOnce(Invoke(this, &GsmSMSClientTest::OnGet)); MockGetCallback callback; EXPECT_CALL(callback, Run(_)) @@ -279,7 +281,7 @@ TEST_F(GsmSMSClientTest, Get) { TEST_F(GsmSMSClientTest, List) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillOnce(Invoke(this, &GsmSMSClientTest::OnList)); MockListCallback callback; EXPECT_CALL(callback, Run(_)) diff --git a/chromeos/dbus/ibus/ibus_client_unittest.cc b/chromeos/dbus/ibus/ibus_client_unittest.cc index 3220e52..d4507b5 100644 --- a/chromeos/dbus/ibus/ibus_client_unittest.cc +++ b/chromeos/dbus/ibus/ibus_client_unittest.cc @@ -137,14 +137,14 @@ class IBusClientTest : public testing::Test { ibus::kServiceName, dbus::ObjectPath( ibus::bus::kServicePath)); - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::kServiceName, - dbus::ObjectPath( - ibus::bus::kServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(ibus::kServiceName, + dbus::ObjectPath(ibus::bus::kServicePath))) .WillOnce(Return(mock_proxy_.get())); - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()); - client_.reset(IBusClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()); + client_.reset( + IBusClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, mock_bus_.get())); } virtual void TearDown() OVERRIDE { @@ -168,7 +168,7 @@ TEST_F(IBusClientTest, CreateInputContextTest) { // Set expectations. const dbus::ObjectPath kInputContextObjectPath = dbus::ObjectPath("/some/object/path"); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnCreateInputContext)); MockCreateInputContextCallback callback; EXPECT_CALL(callback, Run(kInputContextObjectPath)); @@ -195,7 +195,7 @@ TEST_F(IBusClientTest, CreateInputContextTest) { TEST_F(IBusClientTest, CreateInputContext_NullResponseFail) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnCreateInputContext)); MockCreateInputContextCallback callback; EXPECT_CALL(callback, Run(_)).Times(0); @@ -219,7 +219,7 @@ TEST_F(IBusClientTest, CreateInputContext_NullResponseFail) { TEST_F(IBusClientTest, CreateInputContext_InvalidResponseFail) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnCreateInputContext)); MockCreateInputContextCallback callback; EXPECT_CALL(callback, Run(_)).Times(0); @@ -244,7 +244,7 @@ TEST_F(IBusClientTest, CreateInputContext_InvalidResponseFail) { TEST_F(IBusClientTest, CreateInputContext_MethodCallFail) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnCreateInputContextFail)); MockCreateInputContextCallback callback; EXPECT_CALL(callback, Run(_)).Times(0); @@ -268,7 +268,7 @@ TEST_F(IBusClientTest, CreateInputContext_MethodCallFail) { TEST_F(IBusClientTest, SetGlobalEngineTest) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnSetGlobalEngine)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -292,7 +292,7 @@ TEST_F(IBusClientTest, SetGlobalEngineTest) { TEST_F(IBusClientTest, SetGlobalEngineTest_InvalidResponse) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnSetGlobalEngineFail)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -315,7 +315,7 @@ TEST_F(IBusClientTest, SetGlobalEngineTest_InvalidResponse) { TEST_F(IBusClientTest, SetGlobalEngineTest_MethodCallFail) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnSetGlobalEngineFail)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -339,7 +339,7 @@ TEST_F(IBusClientTest, SetGlobalEngineTest_MethodCallFail) { TEST_F(IBusClientTest, ExitTest) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnExit)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -363,7 +363,7 @@ TEST_F(IBusClientTest, ExitTest) { TEST_F(IBusClientTest, ExitTest_InvalidResponse) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnExit)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -386,7 +386,7 @@ TEST_F(IBusClientTest, ExitTest_InvalidResponse) { TEST_F(IBusClientTest, ExitTest_MethodCallFail) { // Set expectations - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusClientTest::OnExitFail)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); diff --git a/chromeos/dbus/ibus/ibus_config_client_unittest.cc b/chromeos/dbus/ibus/ibus_config_client_unittest.cc index 5e636b9..7842da9 100644 --- a/chromeos/dbus/ibus/ibus_config_client_unittest.cc +++ b/chromeos/dbus/ibus/ibus_config_client_unittest.cc @@ -282,9 +282,9 @@ class IBusConfigClientTest : public testing::Test { ibus::kServiceName, dbus::ObjectPath( ibus::config::kServicePath)); - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()); client_.reset(IBusConfigClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); // Surpress uninteresting mock function call warning. EXPECT_CALL(*mock_bus_.get(), AssertOnOriginThread()) @@ -297,31 +297,30 @@ class IBusConfigClientTest : public testing::Test { // Initialize |client_| by replying valid owner name synchronously. void InitializeSync() { - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::config::kServiceName, - dbus::ObjectPath( - ibus::config::kServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(ibus::config::kServiceName, + dbus::ObjectPath(ibus::config::kServicePath))) .WillOnce(Return(mock_proxy_.get())); scoped_refptr<dbus::MockObjectProxy> mock_dbus_proxy = new dbus::MockObjectProxy(mock_bus_.get(), ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath)); - EXPECT_CALL(*mock_bus_, + EXPECT_CALL(*mock_bus_.get(), GetObjectProxy(ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath))) .WillOnce(Return(mock_dbus_proxy.get())); MockGetNameOwnerMethodCallHandler mock_get_name_owner_method_call; - EXPECT_CALL(*mock_dbus_proxy, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_dbus_proxy.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&mock_get_name_owner_method_call, &MockGetNameOwnerMethodCallHandler::Run)); NameOwnerChangedHandler handler; - EXPECT_CALL(*mock_dbus_proxy, ConnectToSignal( - ibus::kDBusInterface, - ibus::kNameOwnerChangedSignal, - _, - _)).WillOnce(Invoke(&handler, - &NameOwnerChangedHandler::OnConnectToSignal)); + EXPECT_CALL(*mock_dbus_proxy.get(), + ConnectToSignal( + ibus::kDBusInterface, ibus::kNameOwnerChangedSignal, _, _)) + .WillOnce( + Invoke(&handler, &NameOwnerChangedHandler::OnConnectToSignal)); client_->InitializeAsync(base::Bind(&base::DoNothing)); mock_get_name_owner_method_call.EmitReplyCallback(":0.1"); } @@ -340,7 +339,7 @@ TEST_F(IBusConfigClientTest, SetStringValueTest) { InitializeSync(); const char value[] = "value"; SetStringValueHandler handler(kSection, kKey, value, HANDLER_SUCCESS); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -356,7 +355,7 @@ TEST_F(IBusConfigClientTest, SetStringValueTest_Fail) { InitializeSync(); const char value[] = "value"; SetStringValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -372,7 +371,7 @@ TEST_F(IBusConfigClientTest, SetIntValueTest) { InitializeSync(); const int value = 1234; SetIntValueHandler handler(kSection, kKey, value, HANDLER_SUCCESS); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -388,7 +387,7 @@ TEST_F(IBusConfigClientTest, SetIntValueTest_Fail) { InitializeSync(); const int value = 1234; SetIntValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -404,7 +403,7 @@ TEST_F(IBusConfigClientTest, SetBoolValueTest) { InitializeSync(); const bool value = true; SetBoolValueHandler handler(kSection, kKey, value, HANDLER_SUCCESS); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -420,7 +419,7 @@ TEST_F(IBusConfigClientTest, SetBoolValueTest_Fail) { InitializeSync(); const bool value = true; SetBoolValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -439,7 +438,7 @@ TEST_F(IBusConfigClientTest, SetStringListValueTest) { value.push_back("Sample value 2"); SetStringListValueHandler handler(kSection, kKey, value, HANDLER_SUCCESS); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); @@ -458,7 +457,7 @@ TEST_F(IBusConfigClientTest, SetStringListValueTest_Fail) { value.push_back("Sample value 2"); SetStringListValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -472,29 +471,27 @@ TEST_F(IBusConfigClientTest, SetStringListValueTest_Fail) { TEST_F(IBusConfigClientTest, IBusConfigDaemon_NotAvailableTest) { MockGetNameOwnerMethodCallHandler mock_get_name_owner_method_call; - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::kServiceName, - dbus::ObjectPath( - ibus::config::kServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(ibus::kServiceName, + dbus::ObjectPath(ibus::config::kServicePath))) .Times(0); scoped_refptr<dbus::MockObjectProxy> mock_dbus_proxy = new dbus::MockObjectProxy(mock_bus_.get(), ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath)); - EXPECT_CALL(*mock_bus_, + EXPECT_CALL(*mock_bus_.get(), GetObjectProxy(ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath))) .WillOnce(Return(mock_dbus_proxy.get())); - EXPECT_CALL(*mock_dbus_proxy, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_dbus_proxy.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&mock_get_name_owner_method_call, &MockGetNameOwnerMethodCallHandler::Run)); NameOwnerChangedHandler handler; - EXPECT_CALL(*mock_dbus_proxy, ConnectToSignal( - ibus::kDBusInterface, - ibus::kNameOwnerChangedSignal, - _, - _)).WillOnce(Invoke(&handler, - &NameOwnerChangedHandler::OnConnectToSignal)); + EXPECT_CALL(*mock_dbus_proxy.get(), + ConnectToSignal( + ibus::kDBusInterface, ibus::kNameOwnerChangedSignal, _, _)) + .WillOnce(Invoke(&handler, &NameOwnerChangedHandler::OnConnectToSignal)); client_->InitializeAsync(base::Bind(&base::DoNothing)); // Passing empty string means there is no owner, thus ibus-config daemon is @@ -503,7 +500,8 @@ TEST_F(IBusConfigClientTest, IBusConfigDaemon_NotAvailableTest) { // Make sure not crashing by function call without initialize. const bool value = true; - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)).Times(0); + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) + .Times(0); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).Times(0); client_->SetBoolValue(kKey, kSection, value, @@ -514,29 +512,28 @@ TEST_F(IBusConfigClientTest, IBusConfigDaemon_NotAvailableTest) { TEST_F(IBusConfigClientTest, IBusConfigDaemon_SlowInitializeTest) { MockGetNameOwnerMethodCallHandler mock_get_name_owner_method_call; - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::config::kServiceName, - dbus::ObjectPath( - ibus::config::kServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(ibus::config::kServiceName, + dbus::ObjectPath(ibus::config::kServicePath))) .WillOnce(Return(mock_proxy_.get())); scoped_refptr<dbus::MockObjectProxy> mock_dbus_proxy = new dbus::MockObjectProxy(mock_bus_.get(), ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath)); - EXPECT_CALL(*mock_bus_, + EXPECT_CALL(*mock_bus_.get(), GetObjectProxy(ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath))) .WillOnce(Return(mock_dbus_proxy.get())); - EXPECT_CALL(*mock_dbus_proxy, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_dbus_proxy.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&mock_get_name_owner_method_call, &MockGetNameOwnerMethodCallHandler::Run)); NameOwnerChangedHandler name_owner_changed_handler; - EXPECT_CALL(*mock_dbus_proxy, ConnectToSignal( - ibus::kDBusInterface, - ibus::kNameOwnerChangedSignal, - _, - _)).WillOnce(Invoke(&name_owner_changed_handler, - &NameOwnerChangedHandler::OnConnectToSignal)); + EXPECT_CALL(*mock_dbus_proxy.get(), + ConnectToSignal( + ibus::kDBusInterface, ibus::kNameOwnerChangedSignal, _, _)) + .WillOnce(Invoke(&name_owner_changed_handler, + &NameOwnerChangedHandler::OnConnectToSignal)); client_->InitializeAsync(base::Bind(&base::DoNothing)); // Passing empty string means there is no owner, thus ibus-config daemon is @@ -552,7 +549,7 @@ TEST_F(IBusConfigClientTest, IBusConfigDaemon_SlowInitializeTest) { // Make sure it is possible to emit method calls. const bool value = true; SetBoolValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()); @@ -566,34 +563,33 @@ TEST_F(IBusConfigClientTest, IBusConfigDaemon_SlowInitializeTest) { TEST_F(IBusConfigClientTest, IBusConfigDaemon_ShutdownTest) { MockGetNameOwnerMethodCallHandler mock_get_name_owner_method_call; - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::config::kServiceName, - dbus::ObjectPath( - ibus::config::kServicePath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(ibus::config::kServiceName, + dbus::ObjectPath(ibus::config::kServicePath))) .WillRepeatedly(Return(mock_proxy_.get())); scoped_refptr<dbus::MockObjectProxy> mock_dbus_proxy = new dbus::MockObjectProxy(mock_bus_.get(), ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath)); - EXPECT_CALL(*mock_bus_, + EXPECT_CALL(*mock_bus_.get(), GetObjectProxy(ibus::kDBusServiceName, dbus::ObjectPath(ibus::kDBusObjectPath))) .WillOnce(Return(mock_dbus_proxy.get())); - EXPECT_CALL(*mock_dbus_proxy, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_dbus_proxy.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(&mock_get_name_owner_method_call, &MockGetNameOwnerMethodCallHandler::Run)); NameOwnerChangedHandler name_owner_changed_handler; - EXPECT_CALL(*mock_dbus_proxy, ConnectToSignal( - ibus::kDBusInterface, - ibus::kNameOwnerChangedSignal, - _, - _)).WillOnce(Invoke(&name_owner_changed_handler, - &NameOwnerChangedHandler::OnConnectToSignal)); + EXPECT_CALL(*mock_dbus_proxy.get(), + ConnectToSignal( + ibus::kDBusInterface, ibus::kNameOwnerChangedSignal, _, _)) + .WillOnce(Invoke(&name_owner_changed_handler, + &NameOwnerChangedHandler::OnConnectToSignal)); client_->InitializeAsync(base::Bind(&base::DoNothing)); const bool value = true; SetBoolValueHandler handler(kSection, kKey, value, HANDLER_FAIL); - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillRepeatedly(Invoke(&handler, &SetValueVerifierBase::Run)); MockErrorCallback error_callback; EXPECT_CALL(error_callback, Run()).WillRepeatedly(Return()); diff --git a/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc b/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc index 146e01a..80c79cd 100644 --- a/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc +++ b/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc @@ -94,25 +94,24 @@ class IBusEngineFactoryServiceTest : public testing::Test { mock_bus_.get(), dbus::ObjectPath(ibus::engine_factory::kServicePath)); - EXPECT_CALL(*mock_bus_, - GetExportedObject(dbus::ObjectPath( - ibus::engine_factory::kServicePath))) + EXPECT_CALL( + *mock_bus_.get(), + GetExportedObject(dbus::ObjectPath(ibus::engine_factory::kServicePath))) .WillOnce(Return(mock_exported_object_.get())); - EXPECT_CALL(*mock_bus_, AssertOnOriginThread()) + EXPECT_CALL(*mock_bus_.get(), AssertOnOriginThread()) .WillRepeatedly(Return()); - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine_factory::kServiceInterface, - ibus::engine_factory::kCreateEngineMethod, - _, - _)) + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine_factory::kServiceInterface, + ibus::engine_factory::kCreateEngineMethod, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusEngineFactoryServiceTest::OnMethodExported)); + Invoke(this, &IBusEngineFactoryServiceTest::OnMethodExported)); service_.reset(IBusEngineFactoryService::Create( - mock_bus_, - REAL_DBUS_CLIENT_IMPLEMENTATION)); + mock_bus_.get(), REAL_DBUS_CLIENT_IMPLEMENTATION)); } protected: diff --git a/chromeos/dbus/ibus/ibus_engine_service_unittest.cc b/chromeos/dbus/ibus/ibus_engine_service_unittest.cc index fc9c05f..ca96ddf 100644 --- a/chromeos/dbus/ibus/ibus_engine_service_unittest.cc +++ b/chromeos/dbus/ibus/ibus_engine_service_unittest.cc @@ -396,77 +396,87 @@ class IBusEngineServiceTest : public testing::Test { GetExportedObject(dbus::ObjectPath(kObjectPath))) .WillOnce(Return(mock_exported_object_.get())); - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kFocusInMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kFocusOutMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kEnableMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kDisableMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kPropertyActivateMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kPropertyShowMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kPropertyHideMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kSetCapabilityMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kResetMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kProcessKeyEventMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kCandidateClickedMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::engine::kServiceInterface, - ibus::engine::kSetSurroundingTextMethod , _, _)) - .WillRepeatedly( - Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kFocusInMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kFocusOutMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL( + *mock_exported_object_.get(), + ExportMethod( + ibus::engine::kServiceInterface, ibus::engine::kEnableMethod, _, _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kDisableMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kPropertyActivateMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kPropertyShowMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kPropertyHideMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kSetCapabilityMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL( + *mock_exported_object_.get(), + ExportMethod( + ibus::engine::kServiceInterface, ibus::engine::kResetMethod, _, _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kProcessKeyEventMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kCandidateClickedMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::engine::kServiceInterface, + ibus::engine::kSetSurroundingTextMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusEngineServiceTest::OnMethodExported)); // Suppress uninteresting mock function call warning. EXPECT_CALL(*mock_bus_.get(), @@ -1021,9 +1031,8 @@ TEST_F(IBusEngineServiceTest, RegisterProperties) { property_list[0]->set_checked(true); RegisterPropertiesExpectation expectation(property_list); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &RegisterPropertiesExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) + .WillOnce(Invoke(&expectation, &RegisterPropertiesExpectation::Evaluate)); // Emit signal. service_->RegisterProperties(property_list); } @@ -1038,7 +1047,7 @@ TEST_F(IBusEngineServiceTest, UpdatePreeditTest) { IBusEngineService::IBUS_ENGINE_PREEEDIT_FOCUS_OUT_MODE_CLEAR; UpdatePreeditExpectation expectation(ibus_text, kCursorPos, kIsVisible, kPreeditMode); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(&expectation, &UpdatePreeditExpectation::Evaluate)); // Emit signal. @@ -1051,9 +1060,8 @@ TEST_F(IBusEngineServiceTest, UpdateAuxiliaryText) { const bool kIsVisible = false; UpdateAuxiliaryTextExpectation expectation(ibus_text, kIsVisible); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &UpdateAuxiliaryTextExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)).WillOnce( + Invoke(&expectation, &UpdateAuxiliaryTextExpectation::Evaluate)); // Emit signal. service_->UpdateAuxiliaryText(ibus_text, kIsVisible); @@ -1067,9 +1075,8 @@ TEST_F(IBusEngineServiceTest, UpdateLookupTableTest) { const bool kIsVisible = true; UpdateLookupTableExpectation expectation(lookup_table, kIsVisible); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &UpdateLookupTableExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) + .WillOnce(Invoke(&expectation, &UpdateLookupTableExpectation::Evaluate)); // Emit signal. service_->UpdateLookupTable(lookup_table, kIsVisible); @@ -1085,9 +1092,8 @@ TEST_F(IBusEngineServiceTest, UpdatePropertyTest) { property.set_checked(true); UpdatePropertyExpectation expectation(property); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &UpdatePropertyExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) + .WillOnce(Invoke(&expectation, &UpdatePropertyExpectation::Evaluate)); // Emit signal. service_->UpdateProperty(property); @@ -1100,9 +1106,8 @@ TEST_F(IBusEngineServiceTest, ForwardKeyEventTest) { ForwardKeyEventExpectation expectation(keyval, keycode, state); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &ForwardKeyEventExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) + .WillOnce(Invoke(&expectation, &ForwardKeyEventExpectation::Evaluate)); // Emit signal. service_->ForwardKeyEvent(keyval, keycode, state); @@ -1110,9 +1115,8 @@ TEST_F(IBusEngineServiceTest, ForwardKeyEventTest) { TEST_F(IBusEngineServiceTest, RequireSurroundingTextTest) { RequireSurroundingTextExpectation expectation; - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) - .WillOnce(Invoke(&expectation, - &RequireSurroundingTextExpectation::Evaluate)); + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)).WillOnce( + Invoke(&expectation, &RequireSurroundingTextExpectation::Evaluate)); // Emit signal. service_->RequireSurroundingText(); diff --git a/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc b/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc index d8b4e2d..457be17 100644 --- a/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc +++ b/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc @@ -101,43 +101,57 @@ class IBusInputContextClientTest : public testing::Test { // Set an expectation so mock_bus's GetObjectProxy() for the given service // name and the object path will return mock_proxy_. The GetObjectProxy // function is called in Initialized function. - EXPECT_CALL(*mock_bus_, GetObjectProxy(ibus::kServiceName, - dbus::ObjectPath(kObjectPath))) + EXPECT_CALL( + *mock_bus_.get(), + GetObjectProxy(ibus::kServiceName, dbus::ObjectPath(kObjectPath))) .WillOnce(Return(mock_proxy_.get())); // Set expectations so mock_proxy's ConnectToSignal will use // OnConnectToSignal() to run the callback. The ConnectToSignal is called in // Initialize function. - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kCommitTextSignal, _, _)) + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kCommitTextSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kForwardKeyEventSignal, _, _)) + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kForwardKeyEventSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kHidePreeditTextSignal, _, _)) + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kHidePreeditTextSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kShowPreeditTextSignal, _, _)) + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kShowPreeditTextSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kUpdatePreeditTextSignal, _, _)) + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kUpdatePreeditTextSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - ibus::input_context::kServiceInterface, - ibus::input_context::kDeleteSurroundingTextSignal, _, _)) + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + EXPECT_CALL( + *mock_proxy_.get(), + ConnectToSignal(ibus::input_context::kServiceInterface, + ibus::input_context::kDeleteSurroundingTextSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); + Invoke(this, &IBusInputContextClientTest::OnConnectToSignal)); // Call Initialize to create object proxy and connect signals. client_->Initialize(mock_bus_.get(), dbus::ObjectPath(kObjectPath)); @@ -470,7 +484,7 @@ TEST_F(IBusInputContextClientTest, UpdatePreeditTextHandlerTest) { TEST_F(IBusInputContextClientTest, FocusInTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusInputContextClientTest::OnFocusIn)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); @@ -484,7 +498,7 @@ TEST_F(IBusInputContextClientTest, FocusInTest) { TEST_F(IBusInputContextClientTest, FocusOutTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusInputContextClientTest::OnFocusOut)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); @@ -498,7 +512,7 @@ TEST_F(IBusInputContextClientTest, FocusOutTest) { TEST_F(IBusInputContextClientTest, ResetTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusInputContextClientTest::OnReset)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); @@ -512,7 +526,7 @@ TEST_F(IBusInputContextClientTest, ResetTest) { TEST_F(IBusInputContextClientTest, SetCapabilitiesTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusInputContextClientTest::OnSetCapabilities)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); @@ -546,7 +560,7 @@ TEST_F(IBusInputContextClientTest, SetCursorLocationTest) { TEST_F(IBusInputContextClientTest, OnProcessKeyEvent) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillOnce(Invoke(this, &IBusInputContextClientTest::OnProcessKeyEvent)); MockProcessKeyEventHandler callback; MockProcessKeyEventErrorHandler error_callback; @@ -573,9 +587,9 @@ TEST_F(IBusInputContextClientTest, OnProcessKeyEvent) { TEST_F(IBusInputContextClientTest, OnProcessKeyEventFail) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) - .WillOnce(Invoke(this, - &IBusInputContextClientTest::OnProcessKeyEventFail)); + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) + .WillOnce( + Invoke(this, &IBusInputContextClientTest::OnProcessKeyEventFail)); MockProcessKeyEventHandler callback; MockProcessKeyEventErrorHandler error_callback; @@ -601,9 +615,9 @@ TEST_F(IBusInputContextClientTest, OnProcessKeyEventFail) { TEST_F(IBusInputContextClientTest, SetSurroundingTextTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) - .WillOnce(Invoke(this, - &IBusInputContextClientTest::OnSetSurroundingText)); + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) + .WillOnce( + Invoke(this, &IBusInputContextClientTest::OnSetSurroundingText)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); response_ = response.get(); @@ -616,9 +630,8 @@ TEST_F(IBusInputContextClientTest, SetSurroundingTextTest) { TEST_F(IBusInputContextClientTest, PropertyActivateTest) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) - .WillOnce(Invoke(this, - &IBusInputContextClientTest::OnPropertyActivate)); + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) + .WillOnce(Invoke(this, &IBusInputContextClientTest::OnPropertyActivate)); // Create response. scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); response_ = response.get(); diff --git a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc index ec7aa74..66ee748 100644 --- a/chromeos/dbus/ibus/ibus_panel_service_unittest.cc +++ b/chromeos/dbus/ibus/ibus_panel_service_unittest.cc @@ -223,71 +223,80 @@ class IBusPanelServiceTest : public testing::Test { ibus::panel::kServicePath))) .WillOnce(Return(mock_exported_object_.get())); - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kUpdateLookupTableMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kHideLookupTableMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kUpdateAuxiliaryTextMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kHideAuxiliaryTextMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kUpdatePreeditTextMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kHidePreeditTextMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kRegisterPropertiesMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kUpdatePropertyMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kFocusInMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kFocusOutMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); - - EXPECT_CALL(*mock_exported_object_, ExportMethod( - ibus::panel::kServiceInterface, - ibus::panel::kStateChangedMethod, _, _)) - .WillRepeatedly( - Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kUpdateLookupTableMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kHideLookupTableMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kUpdateAuxiliaryTextMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kHideAuxiliaryTextMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kUpdatePreeditTextMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kHidePreeditTextMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kRegisterPropertiesMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kUpdatePropertyMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL( + *mock_exported_object_.get(), + ExportMethod( + ibus::panel::kServiceInterface, ibus::panel::kFocusInMethod, _, _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL( + *mock_exported_object_.get(), + ExportMethod( + ibus::panel::kServiceInterface, ibus::panel::kFocusOutMethod, _, _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); + + EXPECT_CALL(*mock_exported_object_.get(), + ExportMethod(ibus::panel::kServiceInterface, + ibus::panel::kStateChangedMethod, + _, + _)) + .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported)); // Suppress uninteresting mock function call warning. EXPECT_CALL(*mock_bus_.get(), @@ -520,7 +529,7 @@ TEST_F(IBusPanelServiceTest, UpdatePreeditTextTest) { TEST_F(IBusPanelServiceTest, CursorUpTest) { // Set expectations. NullArgumentVerifier evaluator(ibus::panel::kCursorUpSignal); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); // Emit signal. @@ -530,7 +539,7 @@ TEST_F(IBusPanelServiceTest, CursorUpTest) { TEST_F(IBusPanelServiceTest, CursorDownTest) { // Set expectations. NullArgumentVerifier evaluator(ibus::panel::kCursorDownSignal); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); // Emit signal. @@ -540,7 +549,7 @@ TEST_F(IBusPanelServiceTest, CursorDownTest) { TEST_F(IBusPanelServiceTest, PageUpTest) { // Set expectations. NullArgumentVerifier evaluator(ibus::panel::kPageUpSignal); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); // Emit signal. @@ -550,7 +559,7 @@ TEST_F(IBusPanelServiceTest, PageUpTest) { TEST_F(IBusPanelServiceTest, PageDownTest) { // Set expectations. NullArgumentVerifier evaluator(ibus::panel::kPageDownSignal); - EXPECT_CALL(*mock_exported_object_, SendSignal(_)) + EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_)) .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); // Emit signal. diff --git a/chromeos/dbus/modem_messaging_client_unittest.cc b/chromeos/dbus/modem_messaging_client_unittest.cc index 9bb6115..7c14fe6 100644 --- a/chromeos/dbus/modem_messaging_client_unittest.cc +++ b/chromeos/dbus/modem_messaging_client_unittest.cc @@ -75,24 +75,26 @@ class ModemMessagingClientTest : public testing::Test { // Set an expectation so mock_proxy's ConnectToSignal() will use // OnConnectToSignal() to run the callback. - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - modemmanager::kModemManager1MessagingInterface, - modemmanager::kSMSAddedSignal, _, _)) + EXPECT_CALL(*mock_proxy_.get(), + ConnectToSignal(modemmanager::kModemManager1MessagingInterface, + modemmanager::kSMSAddedSignal, + _, + _)) .WillRepeatedly( - Invoke(this, &ModemMessagingClientTest::OnConnectToSignal)); + Invoke(this, &ModemMessagingClientTest::OnConnectToSignal)); // Set an expectation so mock_bus's GetObjectProxy() for the given // service name and the object path will return mock_proxy_. - EXPECT_CALL(*mock_bus_, GetObjectProxy(kServiceName, - dbus::ObjectPath(kObjectPath))) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(kServiceName, dbus::ObjectPath(kObjectPath))) .WillOnce(Return(mock_proxy_.get())); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); // Create a client with the mock bus. client_.reset(ModemMessagingClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); } virtual void TearDown() OVERRIDE { @@ -199,7 +201,7 @@ TEST_F(ModemMessagingClientTest, Delete) { // Set expectations. const dbus::ObjectPath kSmsPath("/SMS/0"); expected_sms_path_ = kSmsPath; - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillOnce(Invoke(this, &ModemMessagingClientTest::OnDelete)); MockDeleteCallback callback; EXPECT_CALL(callback, Run()).Times(1); @@ -217,7 +219,7 @@ TEST_F(ModemMessagingClientTest, Delete) { TEST_F(ModemMessagingClientTest, List) { // Set expectations. - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillOnce(Invoke(this, &ModemMessagingClientTest::OnList)); MockListCallback callback; EXPECT_CALL(callback, Run(_)) diff --git a/chromeos/dbus/shill_client_unittest_base.cc b/chromeos/dbus/shill_client_unittest_base.cc index 1fa9b7f..9f52614 100644 --- a/chromeos/dbus/shill_client_unittest_base.cc +++ b/chromeos/dbus/shill_client_unittest_base.cc @@ -115,42 +115,41 @@ void ShillClientUnittestBase::SetUp() { // Set an expectation so mock_proxy's CallMethodAndBlock() will use // OnCallMethodAndBlock() to return responses. - EXPECT_CALL(*mock_proxy_, MockCallMethodAndBlock(_, _)) - .WillRepeatedly(Invoke( - this, &ShillClientUnittestBase::OnCallMethodAndBlock)); + EXPECT_CALL(*mock_proxy_.get(), MockCallMethodAndBlock(_, _)).WillRepeatedly( + Invoke(this, &ShillClientUnittestBase::OnCallMethodAndBlock)); // Set an expectation so mock_proxy's CallMethod() will use OnCallMethod() // to return responses. - EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _)) .WillRepeatedly(Invoke(this, &ShillClientUnittestBase::OnCallMethod)); // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use // OnCallMethodWithErrorCallback() to return responses. - EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) + EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _)) .WillRepeatedly(Invoke( - this, &ShillClientUnittestBase::OnCallMethodWithErrorCallback)); + this, &ShillClientUnittestBase::OnCallMethodWithErrorCallback)); // Set an expectation so mock_proxy's ConnectToSignal() will use // OnConnectToSignal() to run the callback. - EXPECT_CALL(*mock_proxy_, ConnectToSignal( - interface_name_, - flimflam::kMonitorPropertyChanged, _, _)) - .WillRepeatedly(Invoke(this, - &ShillClientUnittestBase::OnConnectToSignal)); + EXPECT_CALL( + *mock_proxy_.get(), + ConnectToSignal(interface_name_, flimflam::kMonitorPropertyChanged, _, _)) + .WillRepeatedly( + Invoke(this, &ShillClientUnittestBase::OnConnectToSignal)); // Set an expectation so mock_bus's GetObjectProxy() for the given // service name and the object path will return mock_proxy_. - EXPECT_CALL(*mock_bus_, GetObjectProxy(flimflam::kFlimflamServiceName, - object_path_)) + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(flimflam::kFlimflamServiceName, object_path_)) .WillOnce(Return(mock_proxy_.get())); // Set an expectation so mock_bus's PostTaskToDBusThread() will run the // given task. - EXPECT_CALL(*mock_bus_, PostTaskToDBusThread(_, _)) + EXPECT_CALL(*mock_bus_.get(), PostTaskToDBusThread(_, _)) .WillRepeatedly(Invoke(&RunTask)); // ShutdownAndBlock() will be called in TearDown(). - EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); } void ShillClientUnittestBase::TearDown() { diff --git a/chromeos/dbus/shill_device_client_unittest.cc b/chromeos/dbus/shill_device_client_unittest.cc index d8f127a..b6c25b5 100644 --- a/chromeos/dbus/shill_device_client_unittest.cc +++ b/chromeos/dbus/shill_device_client_unittest.cc @@ -60,7 +60,7 @@ class ShillDeviceClientTest : public ShillClientUnittestBase { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. client_.reset(ShillDeviceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); } diff --git a/chromeos/dbus/shill_ipconfig_client_unittest.cc b/chromeos/dbus/shill_ipconfig_client_unittest.cc index bb734fd..424935f 100644 --- a/chromeos/dbus/shill_ipconfig_client_unittest.cc +++ b/chromeos/dbus/shill_ipconfig_client_unittest.cc @@ -33,8 +33,8 @@ class ShillIPConfigClientTest : public ShillClientUnittestBase { virtual void SetUp() { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. - client_.reset(ShillIPConfigClient::Create( - REAL_DBUS_CLIENT_IMPLEMENTATION, mock_bus_)); + client_.reset(ShillIPConfigClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, + mock_bus_.get())); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); } diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc index 2021337..ad5b6a0 100644 --- a/chromeos/dbus/shill_manager_client_unittest.cc +++ b/chromeos/dbus/shill_manager_client_unittest.cc @@ -139,7 +139,7 @@ class ShillManagerClientTest : public ShillClientUnittestBase { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. client_.reset(ShillManagerClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); } diff --git a/chromeos/dbus/shill_profile_client_unittest.cc b/chromeos/dbus/shill_profile_client_unittest.cc index fa02ef9..d95b62b 100644 --- a/chromeos/dbus/shill_profile_client_unittest.cc +++ b/chromeos/dbus/shill_profile_client_unittest.cc @@ -42,7 +42,7 @@ class ShillProfileClientTest : public ShillClientUnittestBase { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. client_.reset(ShillProfileClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); } diff --git a/chromeos/dbus/shill_service_client_unittest.cc b/chromeos/dbus/shill_service_client_unittest.cc index 736c215..d4d3bd7 100644 --- a/chromeos/dbus/shill_service_client_unittest.cc +++ b/chromeos/dbus/shill_service_client_unittest.cc @@ -34,7 +34,7 @@ class ShillServiceClientTest : public ShillClientUnittestBase { ShillClientUnittestBase::SetUp(); // Create a client with the mock bus. client_.reset(ShillServiceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, - mock_bus_)); + mock_bus_.get())); // Run the message loop to run the signal connection result callback. message_loop_.RunUntilIdle(); } diff --git a/chromeos/network/onc/onc_certificate_importer_unittest.cc b/chromeos/network/onc/onc_certificate_importer_unittest.cc index c80916a..7713f55 100644 --- a/chromeos/network/onc/onc_certificate_importer_unittest.cc +++ b/chromeos/network/onc/onc_certificate_importer_unittest.cc @@ -140,7 +140,8 @@ class ONCCertificateImporterTest : public testing::Test { bool ok = true; net::CertificateList certs = ListCertsInSlot(); for (size_t i = 0; i < certs.size(); ++i) { - if (!net::NSSCertDatabase::GetInstance()->DeleteCertAndKey(certs[i])) + if (!net::NSSCertDatabase::GetInstance()->DeleteCertAndKey(certs[i] + .get())) ok = false; } return ok; diff --git a/chromeos/process_proxy/process_proxy.cc b/chromeos/process_proxy/process_proxy.cc index 3f67671..990e736 100644 --- a/chromeos/process_proxy/process_proxy.cc +++ b/chromeos/process_proxy/process_proxy.cc @@ -105,7 +105,7 @@ bool ProcessProxy::StartWatchingOnThread( void ProcessProxy::OnProcessOutput(ProcessOutputType type, const std::string& output) { - if (!callback_runner_) + if (!callback_runner_.get()) return; callback_runner_->PostTask( diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index c325900..62037b5 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc @@ -145,8 +145,7 @@ fileapi::ExternalMountPoints* BrowserContext::GetMountPoints( fileapi::ExternalMountPoints::CreateRefCounted(); context->SetUserData( kMountPointsKey, - new UserDataAdapter<fileapi::ExternalMountPoints>( - mount_points)); + new UserDataAdapter<fileapi::ExternalMountPoints>(mount_points.get())); } return UserDataAdapter<fileapi::ExternalMountPoints>::Get( diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index 045fd7e..a70051f 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -644,7 +644,7 @@ class GpuProcessTransportFactory new BrowserCompositorOutputSurface( context, per_compositor_data_[compositor]->surface_id, - output_surface_proxy_, + output_surface_proxy_.get(), base::MessageLoopProxy::current(), compositor->AsWeakPtr()); if (data->reflector.get()) { @@ -664,8 +664,7 @@ class GpuProcessTransportFactory RemoveObserver(data->reflector.get()); data->reflector = new ReflectorImpl( - source, target, output_surface_proxy_, - data->surface_id); + source, target, output_surface_proxy_.get(), data->surface_id); AddObserver(data->reflector.get()); return data->reflector; } @@ -718,8 +717,8 @@ class GpuProcessTransportFactory virtual scoped_refptr<ui::Texture> CreateTransportClient( float device_scale_factor) OVERRIDE { - if (!shared_contexts_main_thread_) - return NULL; + if (!shared_contexts_main_thread_.get()) + return NULL; scoped_refptr<ImageTransportClientTexture> image( new ImageTransportClientTexture( shared_contexts_main_thread_->Context3d(), @@ -731,8 +730,8 @@ class GpuProcessTransportFactory const gfx::Size& size, float device_scale_factor, unsigned int texture_id) OVERRIDE { - if (!shared_contexts_main_thread_) - return NULL; + if (!shared_contexts_main_thread_.get()) + return NULL; scoped_refptr<OwnedTexture> image(new OwnedTexture( shared_contexts_main_thread_->Context3d(), size, @@ -752,13 +751,13 @@ class GpuProcessTransportFactory } virtual uint32 InsertSyncPoint() OVERRIDE { - if (!shared_contexts_main_thread_) + if (!shared_contexts_main_thread_.get()) return 0; return shared_contexts_main_thread_->Context3d()->insertSyncPoint(); } virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE { - if (!shared_contexts_main_thread_) + if (!shared_contexts_main_thread_.get()) return; shared_contexts_main_thread_->Context3d()->waitSyncPoint(sync_point); } @@ -888,10 +887,10 @@ class GpuProcessTransportFactory virtual scoped_refptr<cc::ContextProvider> OffscreenContextProviderForMainThread() OVERRIDE { - if (!shared_contexts_main_thread_ || + if (!shared_contexts_main_thread_.get() || shared_contexts_main_thread_->DestroyedOnMainThread()) { shared_contexts_main_thread_ = MainThreadContextProvider::Create(this); - if (shared_contexts_main_thread_ && + if (shared_contexts_main_thread_.get() && !shared_contexts_main_thread_->BindToCurrentThread()) shared_contexts_main_thread_ = NULL; } @@ -925,7 +924,7 @@ class GpuProcessTransportFactory virtual scoped_refptr<cc::ContextProvider> OffscreenContextProviderForCompositorThread() OVERRIDE { - if (!shared_contexts_compositor_thread_ || + if (!shared_contexts_compositor_thread_.get() || shared_contexts_compositor_thread_->DestroyedOnMainThread()) { shared_contexts_compositor_thread_ = CompositorThreadContextProvider::Create(this); @@ -936,7 +935,7 @@ class GpuProcessTransportFactory void CreateSharedContextLazy() { scoped_refptr<cc::ContextProvider> provider = OffscreenContextProviderForMainThread(); - if (!provider) { + if (!provider.get()) { // If we can't recreate contexts, we won't be able to show the UI. // Better crash at this point. FatalGPUError("Failed to initialize UI shared context."); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index bd2e0a9..48c93b2 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -302,8 +302,8 @@ void SendCompositorFrameAck( const scoped_refptr<ui::Texture>& texture_to_produce) { cc::CompositorFrameAck ack; ack.gl_frame_data.reset(new cc::GLFrameData()); - DCHECK(!texture_to_produce || !skip_frame); - if (texture_to_produce) { + DCHECK(!texture_to_produce.get() || !skip_frame); + if (texture_to_produce.get()) { std::string mailbox_name = texture_to_produce->Produce(); std::copy(mailbox_name.data(), mailbox_name.data() + mailbox_name.length(), @@ -330,8 +330,8 @@ void AcknowledgeBufferForGpu( const scoped_refptr<ui::Texture>& texture_to_produce) { AcceleratedSurfaceMsg_BufferPresented_Params ack; uint32 sync_point = 0; - DCHECK(!texture_to_produce || !skip_frame); - if (texture_to_produce) { + DCHECK(!texture_to_produce.get() || !skip_frame); + if (texture_to_produce.get()) { ack.mailbox_name = texture_to_produce->Produce(); sync_point = content::ImageTransportFactory::GetInstance()->InsertSyncPoint(); @@ -729,7 +729,7 @@ void RenderWidgetHostViewAura::WasShown() { if (cursor_client) NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); - if (!current_surface_ && host_->is_accelerated_compositing_active() && + if (!current_surface_.get() && host_->is_accelerated_compositing_active() && !released_front_lock_.get()) { released_front_lock_ = GetCompositor()->GetCompositorLock(); } @@ -948,9 +948,8 @@ bool RenderWidgetHostViewAura::HasFocus() const { } bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { - return current_surface_ || - current_software_frame_.IsValid() || - !!host_->GetBackingStore(false); + return current_surface_.get() || current_software_frame_.IsValid() || + !!host_->GetBackingStore(false); } void RenderWidgetHostViewAura::Show() { @@ -1213,7 +1212,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback) { - if (!current_surface_) { + if (!current_surface_.get()) { callback.Run(false, SkBitmap()); return; } @@ -1229,7 +1228,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( const base::Callback<void(bool)>& callback) { base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); - if (!current_surface_) + if (!current_surface_.get()) return; // Compute the dest size we want after the letterboxing resize. Make the @@ -1292,14 +1291,13 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( scoped_callback_runner.Release(); yuv_readback_pipeline_->ReadbackYUV( - current_surface_->PrepareTexture(), - target, - callback); + current_surface_->PrepareTexture(), target.get(), callback); } bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { // TODO(skaslev): Implement this path for s/w compositing. - return current_surface_ != NULL && host_->is_accelerated_compositing_active(); + return current_surface_.get() != NULL && + host_->is_accelerated_compositing_active(); } bool RenderWidgetHostViewAura::CanSubscribeFrame() const { @@ -1360,7 +1358,7 @@ void RenderWidgetHostViewAura::UpdateExternalTexture() { accelerated_compositing_state_changed_ = false; bool is_compositing_active = host_->is_accelerated_compositing_active(); - if (is_compositing_active && current_surface_) { + if (is_compositing_active && current_surface_.get()) { window_->layer()->SetExternalTexture(current_surface_.get()); current_frame_size_ = ConvertSizeToDIP( current_surface_->device_scale_factor(), current_surface_->size()); @@ -1406,7 +1404,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); current_surface_ = factory->CreateTransportClient(surface_scale_factor); - if (!current_surface_) { + if (!current_surface_.get()) { LOG(ERROR) << "Failed to create ImageTransport texture"; ack_callback.Run(true, scoped_refptr<ui::Texture>()); return false; @@ -1424,7 +1422,7 @@ void RenderWidgetHostViewAura::SwapBuffersCompleted( const scoped_refptr<ui::Texture>& texture_to_return) { ui::Compositor* compositor = GetCompositor(); - if (frame_subscriber() && current_surface_ != NULL) { + if (frame_subscriber() && current_surface_.get() != NULL) { const base::Time present_time = base::Time::Now(); scoped_refptr<media::VideoFrame> frame; RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; @@ -1687,7 +1685,7 @@ void RenderWidgetHostViewAura::BuffersSwapped( previous_texture->size() != current_texture->size() && SkIRectToRect(damage.getBounds()) != surface_rect) << "Expected full damage rect after size change"; - if (previous_texture && !previous_damage_.isEmpty() && + if (previous_texture.get() && !previous_damage_.isEmpty() && previous_texture->size() == current_texture->size()) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); GLHelper* gl_helper = factory->GetGLHelper(); @@ -1750,7 +1748,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { void RenderWidgetHostViewAura::AcceleratedSurfaceRelease() { // This really tells us to release the frontbuffer. - if (current_surface_) { + if (current_surface_.get()) { ui::Compositor* compositor = GetCompositor(); if (compositor) { // We need to wait for a commit to clear to guarantee that all we @@ -2278,7 +2276,7 @@ scoped_refptr<ui::Texture> RenderWidgetHostViewAura::CopyTexture() { if (!gl_helper) return scoped_refptr<ui::Texture>(); - if (!current_surface_) + if (!current_surface_.get()) return scoped_refptr<ui::Texture>(); WebKit::WebGLId texture_id = diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc index ba69ddf..f7ffd0ec 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc @@ -69,7 +69,7 @@ class ScreenshotTracker : public WebContentsScreenshotManager { virtual void OnScreenshotSet(NavigationEntryImpl* entry) OVERRIDE { --waiting_for_screenshots_; WebContentsScreenshotManager::OnScreenshotSet(entry); - if (waiting_for_screenshots_ == 0 && message_loop_runner_) + if (waiting_for_screenshots_ == 0 && message_loop_runner_.get()) message_loop_runner_->Quit(); } diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index da651e9..c06989d 100644 --- a/content/common/gpu/client/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h @@ -95,7 +95,7 @@ class GpuChannelHost : public IPC::Sender, const IPC::ChannelHandle& channel_handle); bool IsLost() const { - DCHECK(channel_filter_); + DCHECK(channel_filter_.get()); return channel_filter_->IsLost(); } diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index 6020ce4..5adf2d4 100644 --- a/device/bluetooth/bluetooth_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -244,7 +244,7 @@ class BluetoothChromeOSTest : public testing::Test { // Call to fill the adapter_ member with a BluetoothAdapter instance. void GetAdapter() { adapter_ = new BluetoothAdapterChromeOS(); - ASSERT_TRUE(adapter_ != NULL); + ASSERT_TRUE(adapter_.get() != NULL); ASSERT_TRUE(adapter_->IsInitialized()); } @@ -254,7 +254,7 @@ class BluetoothChromeOSTest : public testing::Test { // The correct behavior of discovery is tested by the "Discovery" test case // without using this function. void DiscoverDevice(const std::string& address) { - ASSERT_TRUE(adapter_ != NULL); + ASSERT_TRUE(adapter_.get() != NULL); if (base::MessageLoop::current() == NULL) { base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); diff --git a/device/bluetooth/bluetooth_profile_chromeos.cc b/device/bluetooth/bluetooth_profile_chromeos.cc index f4b8ccc..6d0bb4e 100644 --- a/device/bluetooth/bluetooth_profile_chromeos.cc +++ b/device/bluetooth/bluetooth_profile_chromeos.cc @@ -157,7 +157,7 @@ void BluetoothProfileChromeOS::NewConnection( // base::Passed is used to take ownership of the file descriptor during the // CheckValidity() call and pass that ownership to the GetAdapter() call. base::PostTaskAndReplyWithResult( - base::WorkerPool::GetTaskRunner(false), + base::WorkerPool::GetTaskRunner(false).get(), FROM_HERE, base::Bind(&CheckValidity, base::Passed(&fd)), base::Bind(&BluetoothProfileChromeOS::GetAdapter, diff --git a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc index 271fe46..b59a635 100644 --- a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc @@ -48,7 +48,7 @@ class BluetoothProfileChromeOSTest : public testing::Test { device::BluetoothAdapterFactory::GetAdapter( base::Bind(&BluetoothProfileChromeOSTest::AdapterCallback, base::Unretained(this))); - ASSERT_TRUE(adapter_ != NULL); + ASSERT_TRUE(adapter_.get() != NULL); ASSERT_TRUE(adapter_->IsInitialized()); ASSERT_TRUE(adapter_->IsPresent()); @@ -171,7 +171,7 @@ TEST_F(BluetoothProfileChromeOSTest, L2capEndToEnd) { // Read data from the socket; since no data should be waiting, this should // return success but no data. read_buffer = new net::GrowableIOBuffer; - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); EXPECT_TRUE(success); EXPECT_EQ(0, read_buffer->capacity()); EXPECT_EQ(0, read_buffer->offset()); @@ -179,8 +179,9 @@ TEST_F(BluetoothProfileChromeOSTest, L2capEndToEnd) { // Write data to the socket; the data should be consumed and no bytes should // be remaining. - write_buffer = new net::DrainableIOBuffer(base_buffer, base_buffer->size()); - success = socket->Send(write_buffer); + write_buffer = + new net::DrainableIOBuffer(base_buffer.get(), base_buffer->size()); + success = socket->Send(write_buffer.get()); EXPECT_TRUE(success); EXPECT_EQ(base_buffer->size(), write_buffer->BytesConsumed()); EXPECT_EQ(0, write_buffer->BytesRemaining()); @@ -191,7 +192,7 @@ TEST_F(BluetoothProfileChromeOSTest, L2capEndToEnd) { // to read. read_buffer = new net::GrowableIOBuffer; do { - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); } while (success && read_buffer->offset() == 0); EXPECT_TRUE(success); EXPECT_NE(0, read_buffer->capacity()); @@ -204,8 +205,9 @@ TEST_F(BluetoothProfileChromeOSTest, L2capEndToEnd) { // Write data to the socket; since the socket is closed, this should return // an error without writing the data and "Disconnected" as the message. - write_buffer = new net::DrainableIOBuffer(base_buffer, base_buffer->size()); - success = socket->Send(write_buffer); + write_buffer = + new net::DrainableIOBuffer(base_buffer.get(), base_buffer->size()); + success = socket->Send(write_buffer.get()); EXPECT_FALSE(success); EXPECT_EQ(0, write_buffer->BytesConsumed()); EXPECT_EQ(base_buffer->size(), write_buffer->BytesRemaining()); @@ -214,7 +216,7 @@ TEST_F(BluetoothProfileChromeOSTest, L2capEndToEnd) { // Read data from the socket; since the socket is closed, this should return // an error with "Disconnected" as the last message. read_buffer = new net::GrowableIOBuffer; - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); EXPECT_FALSE(success); EXPECT_EQ(0, read_buffer->capacity()); EXPECT_EQ(0, read_buffer->offset()); @@ -295,15 +297,16 @@ TEST_F(BluetoothProfileChromeOSTest, RfcommEndToEnd) { // Read data from the socket; since no data should be waiting, this should // return success but no data. read_buffer = new net::GrowableIOBuffer; - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); EXPECT_TRUE(success); EXPECT_EQ(0, read_buffer->offset()); EXPECT_EQ("", socket->GetLastErrorMessage()); // Write data to the socket; the data should be consumed and no bytes should // be remaining. - write_buffer = new net::DrainableIOBuffer(base_buffer, base_buffer->size()); - success = socket->Send(write_buffer); + write_buffer = + new net::DrainableIOBuffer(base_buffer.get(), base_buffer->size()); + success = socket->Send(write_buffer.get()); EXPECT_TRUE(success); EXPECT_EQ(base_buffer->size(), write_buffer->BytesConsumed()); EXPECT_EQ(0, write_buffer->BytesRemaining()); @@ -314,7 +317,7 @@ TEST_F(BluetoothProfileChromeOSTest, RfcommEndToEnd) { // to read. read_buffer = new net::GrowableIOBuffer; do { - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); } while (success && read_buffer->offset() == 0); EXPECT_TRUE(success); EXPECT_NE(0, read_buffer->capacity()); @@ -327,8 +330,9 @@ TEST_F(BluetoothProfileChromeOSTest, RfcommEndToEnd) { // Write data to the socket; since the socket is closed, this should return // an error without writing the data and "Disconnected" as the message. - write_buffer = new net::DrainableIOBuffer(base_buffer, base_buffer->size()); - success = socket->Send(write_buffer); + write_buffer = + new net::DrainableIOBuffer(base_buffer.get(), base_buffer->size()); + success = socket->Send(write_buffer.get()); EXPECT_FALSE(success); EXPECT_EQ(0, write_buffer->BytesConsumed()); EXPECT_EQ(base_buffer->size(), write_buffer->BytesRemaining()); @@ -337,7 +341,7 @@ TEST_F(BluetoothProfileChromeOSTest, RfcommEndToEnd) { // Read data from the socket; since the socket is closed, this should return // an error with "Disconnected" as the last message. read_buffer = new net::GrowableIOBuffer; - success = socket->Receive(read_buffer); + success = socket->Receive(read_buffer.get()); EXPECT_FALSE(success); EXPECT_EQ(0, read_buffer->offset()); EXPECT_EQ("Disconnected", socket->GetLastErrorMessage()); diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc index 08d3177..bcdbd61 100644 --- a/ui/aura/bench/bench_main.cc +++ b/ui/aura/bench/bench_main.cc @@ -212,7 +212,7 @@ class WebGLBench : public BenchCompositorObserver { texture_ = new WebGLTexture(context_.get(), bounds.size()); fbo_ = context_->createFramebuffer(); compositor->AddObserver(this); - webgl_.SetExternalTexture(texture_); + webgl_.SetExternalTexture(texture_.get()); context_->bindFramebuffer(GL_FRAMEBUFFER, fbo_); context_->framebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, @@ -237,7 +237,7 @@ class WebGLBench : public BenchCompositorObserver { context_->clear(GL_COLOR_BUFFER_BIT); context_->flush(); } - webgl_.SetExternalTexture(texture_); + webgl_.SetExternalTexture(texture_.get()); webgl_.SchedulePaint(gfx::Rect(webgl_.bounds().size())); compositor_->ScheduleDraw(); } diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 7146049..26f3929 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -158,7 +158,7 @@ ui::Layer* Window::RecreateLayer() { cc::TextureMailbox old_mailbox = old_layer->GetTextureMailbox(&mailbox_scale_factor); scoped_refptr<ui::Texture> old_texture = old_layer->external_texture(); - if (delegate_ && old_texture) + if (delegate_ && old_texture.get()) old_layer->SetExternalTexture(delegate_->CopyTexture()); layer_ = new ui::Layer(old_layer->type()); @@ -170,8 +170,8 @@ ui::Layer* Window::RecreateLayer() { // Move the original texture to the new layer if the old layer has a // texture and we could copy it into the old layer, // crbug.com/175211. - if (delegate_ && old_texture) { - layer_->SetExternalTexture(old_texture); + if (delegate_ && old_texture.get()) { + layer_->SetExternalTexture(old_texture.get()); } else if (old_mailbox.IsSharedMemory()) { base::SharedMemory* old_buffer = old_mailbox.shared_memory(); const size_t size = old_mailbox.shared_memory_size_in_bytes(); diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc index d7b7a90..b199851 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.cc +++ b/webkit/browser/fileapi/obfuscated_file_util.cc @@ -1283,7 +1283,7 @@ void ObfuscatedFileUtil::InvalidateUsageCache( void ObfuscatedFileUtil::MarkUsed() { if (!timer_) - timer_.reset(new TimedTaskHelper(file_task_runner_)); + timer_.reset(new TimedTaskHelper(file_task_runner_.get())); if (timer_->IsRunning()) { timer_->Reset(); diff --git a/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc b/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc index 8f83eae..b19df1d 100644 --- a/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc +++ b/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc @@ -118,7 +118,7 @@ void OnCreateSnapshotFile( const base::PlatformFileInfo& file_info, const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { - DCHECK(!file_ref); + DCHECK(!file_ref.get()); DCHECK(file_info_out); DCHECK(platform_path_out); *file_info_out = file_info; |