diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-02 21:13:46 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-02 21:13:46 +0000 |
commit | fc72bb18b111ff63e57135d97de6d59291f3b7b8 (patch) | |
tree | f7fedf0a0577e38a0486e8bdc88a47a508bf122d /content/browser/renderer_host | |
parent | 7cd76fded67d66fb8ea4f5abce5241ad71d749a9 (diff) | |
download | chromium_src-fc72bb18b111ff63e57135d97de6d59291f3b7b8.zip chromium_src-fc72bb18b111ff63e57135d97de6d59291f3b7b8.tar.gz chromium_src-fc72bb18b111ff63e57135d97de6d59291f3b7b8.tar.bz2 |
Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*"
Linux fixes
BUG=110610
TBR=darin
Review URL: https://chromiumcodereview.appspot.com/16294003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host')
31 files changed, 236 insertions, 213 deletions
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc index e32765d..9385bb0 100644 --- a/content/browser/renderer_host/database_message_filter.cc +++ b/content/browser/renderer_host/database_message_filter.cc @@ -44,7 +44,7 @@ DatabaseMessageFilter::DatabaseMessageFilter( webkit_database::DatabaseTracker* db_tracker) : db_tracker_(db_tracker), observer_added_(false) { - DCHECK(db_tracker_); + DCHECK(db_tracker_.get()); } void DatabaseMessageFilter::OnChannelClosing() { @@ -135,9 +135,9 @@ void DatabaseMessageFilter::OnDatabaseOpenFile(const string16& vfs_file_name, &database_name, NULL) && !db_tracker_->IsDatabaseScheduledForDeletion(origin_identifier, database_name)) { - base::FilePath db_file = - DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); - if (!db_file.empty()) { + base::FilePath db_file = DatabaseUtil::GetFullFilePathForVfsFile( + db_tracker_.get(), vfs_file_name); + if (!db_file.empty()) { if (db_tracker_->IsIncognitoProfile()) { db_tracker_->GetIncognitoFileHandle(vfs_file_name, &file_handle); if (file_handle == base::kInvalidPlatformFileValue) { @@ -180,7 +180,7 @@ void DatabaseMessageFilter::DatabaseDeleteFile(const string16& vfs_file_name, // be deleted after kNumDeleteRetries attempts. int error_code = SQLITE_IOERR_DELETE; base::FilePath db_file = - DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); + DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name); if (!db_file.empty()) { // In order to delete a journal file in incognito mode, we only need to // close the open handle to it that's stored in the database tracker. @@ -222,7 +222,7 @@ void DatabaseMessageFilter::OnDatabaseGetFileAttributes( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); int32 attributes = -1; base::FilePath db_file = - DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); + DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name); if (!db_file.empty()) attributes = VfsBackend::GetFileAttributes(db_file); @@ -236,7 +236,7 @@ void DatabaseMessageFilter::OnDatabaseGetFileSize( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); int64 size = 0; base::FilePath db_file = - DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); + DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name); if (!db_file.empty()) size = VfsBackend::GetFileSize(db_file); diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc index 5f87a75..762381b 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager.cc @@ -49,7 +49,7 @@ void AudioInputDeviceManager::Register( base::MessageLoopProxy* device_thread_loop) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!listener_); - DCHECK(!device_loop_); + DCHECK(!device_loop_.get()); listener_ = listener; device_loop_ = device_thread_loop; } diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.cc b/content/browser/renderer_host/media/audio_input_renderer_host.cc index 38a45f2..e97bad7 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_input_renderer_host.cc @@ -285,7 +285,7 @@ void AudioInputRendererHost::OnCreateStream( entry->writer.get()); } - if (!entry->controller) { + if (!entry->controller.get()) { SendErrorMessage(stream_id); return; } @@ -395,7 +395,7 @@ AudioInputRendererHost::AudioEntry* AudioInputRendererHost::LookupByController( // TODO(hclam): Implement a faster look up method. for (AudioEntryMap::iterator i = audio_entries_.begin(); i != audio_entries_.end(); ++i) { - if (controller == i->second->controller) + if (controller == i->second->controller.get()) return i->second; } return NULL; diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 3b21720..59bb567 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc @@ -45,9 +45,7 @@ class AudioRendererHost::AudioEntry return render_view_id_; } - media::AudioOutputController* controller() const { - return controller_; - } + media::AudioOutputController* controller() const { return controller_.get(); } base::SharedMemory* shared_memory() { return shared_memory_.get(); @@ -95,7 +93,7 @@ AudioRendererHost::AudioEntry::AudioEntry( host->audio_manager_, this, params, reader.get())), shared_memory_(shared_memory.Pass()), reader_(reader.Pass()) { - DCHECK(controller_); + DCHECK(controller_.get()); } AudioRendererHost::AudioEntry::~AudioEntry() {} diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc index 6a674a4..bd4913b 100644 --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc @@ -198,7 +198,7 @@ class AudioRendererHostTest : public testing::Test { void Create() { EXPECT_CALL(*observer_, OnSetAudioStreamStatus(_, kStreamId, "created")); - EXPECT_CALL(*host_, OnStreamCreated(kStreamId, _)) + EXPECT_CALL(*host_.get(), OnStreamCreated(kStreamId, _)) .WillOnce(QuitMessageLoop(message_loop_.get())); EXPECT_CALL(mirroring_manager_, AddDiverter(kRenderProcessId, kRenderViewId, NotNull())) @@ -239,7 +239,7 @@ class AudioRendererHostTest : public testing::Test { void Play() { EXPECT_CALL(*observer_, OnSetAudioStreamPlaying(_, kStreamId, true)); - EXPECT_CALL(*host_, OnStreamPlaying(kStreamId)) + EXPECT_CALL(*host_.get(), OnStreamPlaying(kStreamId)) .WillOnce(QuitMessageLoop(message_loop_.get())); host_->OnPlayStream(kStreamId); @@ -249,7 +249,7 @@ class AudioRendererHostTest : public testing::Test { void Pause() { EXPECT_CALL(*observer_, OnSetAudioStreamPlaying(_, kStreamId, false)); - EXPECT_CALL(*host_, OnStreamPaused(kStreamId)) + EXPECT_CALL(*host_.get(), OnStreamPaused(kStreamId)) .WillOnce(QuitMessageLoop(message_loop_.get())); host_->OnPauseStream(kStreamId); @@ -271,7 +271,7 @@ class AudioRendererHostTest : public testing::Test { << "Calls Create() before calling this method"; // Expect an error signal sent through IPC. - EXPECT_CALL(*host_, OnStreamError(kStreamId)); + EXPECT_CALL(*host_.get(), OnStreamError(kStreamId)); // Simulate an error sent from the audio device. host_->ReportErrorAndClose(kStreamId); diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index ceefb98..4724338 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -160,7 +160,7 @@ class MediaStreamDispatcherHostTest : public testing::Test { // Use the fake content client and browser. content_client_.reset(new TestContentClient); SetContentClient(content_client_.get()); - old_browser_client_ = SetBrowserClientForTesting(host_); + old_browser_client_ = SetBrowserClientForTesting(host_.get()); } virtual void SetupFakeUI(bool expect_started) { @@ -197,7 +197,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStream) { StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); SetupFakeUI(true); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); + EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); host_->OnGenerateStream(kPageRequestId, options); WaitForResult(); @@ -220,7 +220,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateThreeStreams) { // Generate first stream. SetupFakeUI(true); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); + EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); host_->OnGenerateStream(kPageRequestId, options); WaitForResult(); @@ -236,9 +236,9 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateThreeStreams) { // Generate second stream. SetupFakeUI(true); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1)); - host_->OnGenerateStream(kPageRequestId+1, options); - + EXPECT_CALL(*host_.get(), + OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1)); + host_->OnGenerateStream(kPageRequestId + 1, options); WaitForResult(); @@ -255,8 +255,9 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateThreeStreams) { // Generate third stream. SetupFakeUI(true); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId + 2, 0, 1)); - host_->OnGenerateStream(kPageRequestId+2, options); + EXPECT_CALL(*host_.get(), + OnStreamGenerated(kRenderId, kPageRequestId + 2, 0, 1)); + host_->OnGenerateStream(kPageRequestId + 2, options); WaitForResult(); @@ -284,7 +285,8 @@ TEST_F(MediaStreamDispatcherHostTest, FailOpenVideoDevice) { media::FakeVideoCaptureDevice::SetFailNextCreate(); SetupFakeUI(false); host_->OnGenerateStream(kPageRequestId, options); - EXPECT_CALL(*host_, OnStreamGenerationFailed(kRenderId, kPageRequestId)); + EXPECT_CALL(*host_.get(), + OnStreamGenerationFailed(kRenderId, kPageRequestId)); WaitForResult(); } @@ -312,7 +314,8 @@ TEST_F(MediaStreamDispatcherHostTest, StopGeneratedStreamsOnChannelClosing) { size_t generated_streams = 3; for (size_t i = 0; i < generated_streams; ++i) { SetupFakeUI(true); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId + i, 0, 1)); + EXPECT_CALL(*host_.get(), + OnStreamGenerated(kRenderId, kPageRequestId + i, 0, 1)); host_->OnGenerateStream(kPageRequestId + i, options); // Wait until the stream is generated. @@ -338,8 +341,9 @@ TEST_F(MediaStreamDispatcherHostTest, CloseFromUI) { .WillOnce(SaveArg<0>(&close_callback)); media_stream_manager_->UseFakeUI(stream_ui.PassAs<MediaStreamUI>()); - EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); - EXPECT_CALL(*host_, OnStreamGenerationFailed(kRenderId, kPageRequestId)); + EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); + EXPECT_CALL(*host_.get(), + OnStreamGenerationFailed(kRenderId, kPageRequestId)); host_->OnGenerateStream(kPageRequestId, options); WaitForResult(); diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 1d63262..84c2dc1 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc @@ -176,14 +176,14 @@ MediaStreamManager::~MediaStreamManager() { VideoCaptureManager* MediaStreamManager::video_capture_manager() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(video_capture_manager_); - return video_capture_manager_; + DCHECK(video_capture_manager_.get()); + return video_capture_manager_.get(); } AudioInputDeviceManager* MediaStreamManager::audio_input_device_manager() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(audio_input_device_manager_); - return audio_input_device_manager_; + DCHECK(audio_input_device_manager_.get()); + return audio_input_device_manager_.get(); } std::string MediaStreamManager::MakeMediaAccessRequest( diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool.cc b/content/browser/renderer_host/media/video_capture_buffer_pool.cc index 8a6a0f86b..65c9497 100644 --- a/content/browser/renderer_host/media/video_capture_buffer_pool.cc +++ b/content/browser/renderer_host/media/video_capture_buffer_pool.cc @@ -91,7 +91,7 @@ scoped_refptr<media::VideoFrame> VideoCaptureBufferPool::ReserveForProducer( if (buffer->rotation != rotation) { // TODO(nick): Generalize the |rotation| mechanism. - media::FillYUV(frame, 0, 128, 128); + media::FillYUV(frame.get(), 0, 128, 128); buffer->rotation = rotation; } diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc index f26b51a..60d5881 100644 --- a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc @@ -35,9 +35,9 @@ TEST(VideoCaptureBufferPoolTest, BufferPool) { ASSERT_TRUE(NULL != frame3.get()); // Touch the memory. - media::FillYUV(frame1, 0x11, 0x22, 0x33); - media::FillYUV(frame2, 0x44, 0x55, 0x66); - media::FillYUV(frame3, 0x77, 0x88, 0x99); + media::FillYUV(frame1.get(), 0x11, 0x22, 0x33); + media::FillYUV(frame2.get(), 0x44, 0x55, 0x66); + media::FillYUV(frame3.get(), 0x77, 0x88, 0x99); // Fourth frame should fail. ASSERT_EQ(NULL, pool->ReserveForProducer(0).get()) << "Pool should be empty"; @@ -87,7 +87,7 @@ TEST(VideoCaptureBufferPoolTest, BufferPool) { pool->RelinquishConsumerHold(buffer_id3, 1); ASSERT_FALSE(pool->IsAnyBufferHeldForConsumers()); frame3 = pool->ReserveForProducer(0); - ASSERT_TRUE(NULL != frame3); + ASSERT_TRUE(NULL != frame3.get()); ASSERT_FALSE(pool->IsAnyBufferHeldForConsumers()); ASSERT_EQ(NULL, pool->ReserveForProducer(0).get()) << "Pool should be empty"; @@ -106,7 +106,7 @@ TEST(VideoCaptureBufferPoolTest, BufferPool) { ASSERT_EQ(NULL, pool->ReserveForProducer(0).get()) << "Pool should be empty"; frame1 = NULL; // Should free the frame. frame2 = pool->ReserveForProducer(0); - ASSERT_TRUE(NULL != frame2); + ASSERT_TRUE(NULL != frame2.get()); ASSERT_EQ(buffer_id1, pool->RecognizeReservedBuffer(frame2)); ASSERT_EQ(NULL, pool->ReserveForProducer(0).get()) << "Pool should be empty"; @@ -114,7 +114,7 @@ TEST(VideoCaptureBufferPoolTest, BufferPool) { // that this buffer has been through the consumer-hold cycle. frame2 = NULL; frame1 = pool->ReserveForProducer(0); - ASSERT_TRUE(NULL != frame1); + ASSERT_TRUE(NULL != frame1.get()); ASSERT_EQ(buffer_id1, pool->RecognizeReservedBuffer(frame1)); ASSERT_EQ(NULL, pool->ReserveForProducer(0).get()) << "Pool should be empty"; @@ -124,12 +124,12 @@ TEST(VideoCaptureBufferPoolTest, BufferPool) { pool = NULL; // Touch the memory. - media::FillYUV(frame1, 0x11, 0x22, 0x33); - media::FillYUV(frame4, 0x44, 0x55, 0x66); + media::FillYUV(frame1.get(), 0x11, 0x22, 0x33); + media::FillYUV(frame4.get(), 0x44, 0x55, 0x66); frame1 = NULL; - media::FillYUV(frame4, 0x44, 0x55, 0x66); + media::FillYUV(frame4.get(), 0x44, 0x55, 0x66); frame4 = NULL; } diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index a0a0cd1..ef5aba2 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc @@ -178,9 +178,10 @@ void VideoCaptureController::StopCapture( return; // Take back all buffers held by the |client|. - if (buffer_pool_) { + if (buffer_pool_.get()) { for (std::set<int>::iterator buffer_it = client->buffers.begin(); - buffer_it != client->buffers.end(); ++buffer_it) { + buffer_it != client->buffers.end(); + ++buffer_it) { int buffer_id = *buffer_it; buffer_pool_->RelinquishConsumerHold(buffer_id, 1); } @@ -246,7 +247,7 @@ void VideoCaptureController::ReturnBuffer( scoped_refptr<media::VideoFrame> VideoCaptureController::ReserveOutputBuffer() { base::AutoLock lock(buffer_pool_lock_); - if (!buffer_pool_) + if (!buffer_pool_.get()) return NULL; return buffer_pool_->ReserveForProducer(0); } @@ -268,12 +269,12 @@ void VideoCaptureController::OnIncomingCapturedFrame( scoped_refptr<media::VideoFrame> dst; { base::AutoLock lock(buffer_pool_lock_); - if (!buffer_pool_) + if (!buffer_pool_.get()) return; dst = buffer_pool_->ReserveForProducer(rotation); } - if (!dst) + if (!dst.get()) return; uint8* yplane = dst->data(media::VideoFrame::kYPlane); @@ -367,7 +368,7 @@ void VideoCaptureController::OnIncomingCapturedVideoFrame( { base::AutoLock lock(buffer_pool_lock_); - if (!buffer_pool_) + if (!buffer_pool_.get()) return; // If this is a frame that belongs to the buffer pool, we can forward it @@ -384,7 +385,7 @@ void VideoCaptureController::OnIncomingCapturedVideoFrame( target = buffer_pool_->ReserveForProducer(0); } - if (!target) + if (!target.get()) return; // Validate the inputs. @@ -422,15 +423,15 @@ void VideoCaptureController::OnIncomingCapturedVideoFrame( media::CopyYPlane(frame->data(kYPlane), frame->stride(kYPlane), frame->rows(kYPlane), - target); + target.get()); media::CopyUPlane(frame->data(kUPlane), frame->stride(kUPlane), frame->rows(kUPlane), - target); + target.get()); media::CopyVPlane(frame->data(kVPlane), frame->stride(kVPlane), frame->rows(kVPlane), - target); + target.get()); break; } case media::VideoFrame::YV12A: { @@ -438,19 +439,19 @@ void VideoCaptureController::OnIncomingCapturedVideoFrame( media::CopyYPlane(frame->data(kYPlane), frame->stride(kYPlane), frame->rows(kYPlane), - target); + target.get()); media::CopyUPlane(frame->data(kUPlane), frame->stride(kUPlane), frame->rows(kUPlane), - target); + target.get()); media::CopyVPlane(frame->data(kVPlane), frame->stride(kVPlane), frame->rows(kVPlane), - target); + target.get()); media::CopyAPlane(frame->data(kAPlane), frame->stride(kAPlane), frame->rows(kAPlane), - target); + target.get()); break; } case media::VideoFrame::RGB32: { @@ -520,7 +521,7 @@ void VideoCaptureController::DoIncomingCapturedFrameOnIOThread( base::Time timestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (!buffer_pool_) + if (!buffer_pool_.get()) return; int buffer_id = buffer_pool_->RecognizeReservedBuffer(reserved_frame); @@ -548,7 +549,7 @@ void VideoCaptureController::DoIncomingCapturedFrameOnIOThread( void VideoCaptureController::DoFrameInfoOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(!buffer_pool_) + DCHECK(!buffer_pool_.get()) << "Device is restarted without releasing shared memory."; // Allocate memory only when device has been started. @@ -609,7 +610,7 @@ void VideoCaptureController::SendFrameInfoAndBuffers(ControllerClient* client) { client->event_handler->OnFrameInfo(client->controller_id, frame_info_.width, frame_info_.height, frame_info_.frame_rate); - if (!buffer_pool_) + if (!buffer_pool_.get()) return; for (int buffer_id = 1; buffer_id <= buffer_pool_->count(); ++buffer_id) { @@ -660,7 +661,7 @@ void VideoCaptureController::PostStopping() { // When clients still have some buffers, or device has not been stopped yet, // do nothing. - if ((buffer_pool_ && buffer_pool_->IsAnyBufferHeldForConsumers()) || + if ((buffer_pool_.get() && buffer_pool_->IsAnyBufferHeldForConsumers()) || device_in_use_) return; diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc index 544001f9..bc67fe4 100644 --- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc @@ -156,10 +156,9 @@ class VideoCaptureControllerTest : public testing::Test { vcm_ = new MockVideoCaptureManager(); vcm_->Init(); - controller_ = new VideoCaptureController(vcm_); - controller_handler_.reset( - new MockVideoCaptureControllerEventHandler(controller_.get(), - message_loop_.get())); + controller_ = new VideoCaptureController(vcm_.get()); + controller_handler_.reset(new MockVideoCaptureControllerEventHandler( + controller_.get(), message_loop_.get())); } virtual void TearDown() OVERRIDE {} @@ -184,11 +183,10 @@ TEST_F(VideoCaptureControllerTest, StartAndStop) { capture_params.frame_per_second = 30; InSequence s; - EXPECT_CALL(*vcm_, + EXPECT_CALL(*vcm_.get(), StartCapture(capture_params.width, capture_params.height, - controller_.get())) - .Times(1); + controller_.get())).Times(1); EXPECT_CALL(*controller_handler_, DoFrameInfo(controller_handler_->controller_id_)) .Times(AtLeast(1)); @@ -202,9 +200,7 @@ TEST_F(VideoCaptureControllerTest, StartAndStop) { controller_handler_->controller_id_, controller_handler_.get(), message_loop_.get())); - EXPECT_CALL(*vcm_, - StopCapture(vcm_->video_session_id_)) - .Times(1); + EXPECT_CALL(*vcm_.get(), StopCapture(vcm_->video_session_id_)).Times(1); controller_->StartCapture(controller_handler_->controller_id_, controller_handler_.get(), @@ -222,11 +218,10 @@ TEST_F(VideoCaptureControllerTest, StopSession) { capture_params.frame_per_second = 30; InSequence s; - EXPECT_CALL(*vcm_, + EXPECT_CALL(*vcm_.get(), StartCapture(capture_params.width, capture_params.height, - controller_.get())) - .Times(1); + controller_.get())).Times(1); EXPECT_CALL(*controller_handler_, DoFrameInfo(controller_handler_->controller_id_)) .Times(AtLeast(1)); @@ -258,9 +253,7 @@ TEST_F(VideoCaptureControllerTest, StopSession) { base::MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); message_loop_->Run(); - EXPECT_CALL(*vcm_, - StopCapture(vcm_->video_session_id_)) - .Times(1); + EXPECT_CALL(*vcm_.get(), StopCapture(vcm_->video_session_id_)).Times(1); controller_->StopCapture(controller_handler_->controller_id_, controller_handler_.get()); } diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc index 91d8f51..9c4fc77 100644 --- a/content/browser/renderer_host/media/video_capture_host.cc +++ b/content/browser/renderer_host/media/video_capture_host.cc @@ -32,7 +32,7 @@ void VideoCaptureHost::OnChannelClosing() { // Since the IPC channel is gone, close all requested VideCaptureDevices. for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { - VideoCaptureController* controller = it->second->controller; + VideoCaptureController* controller = it->second->controller.get(); if (controller) { VideoCaptureControllerID controller_id(it->first); controller->StopCapture(controller_id, this); @@ -255,7 +255,7 @@ void VideoCaptureHost::OnReceiveEmptyBuffer(int device_id, int buffer_id) { EntryMap::iterator it = entries_.find(controller_id); if (it != entries_.end()) { scoped_refptr<VideoCaptureController> controller = it->second->controller; - if (controller) + if (controller.get()) controller->ReturnBuffer(controller_id, this, buffer_id); } } @@ -268,7 +268,7 @@ void VideoCaptureHost::DeleteVideoCaptureControllerOnIOThread( if (it == entries_.end()) return; - VideoCaptureController* controller = it->second->controller; + VideoCaptureController* controller = it->second->controller.get(); if (controller) { controller->StopCapture(controller_id, this); GetVideoCaptureManager()->RemoveController(controller, this); diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc index 6da2b9f..3f35988 100644 --- a/content/browser/renderer_host/media/video_capture_host_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc @@ -223,10 +223,10 @@ class VideoCaptureHostTest : public testing::Test { virtual void TearDown() OVERRIDE { // Verifies and removes the expectations on host_ and // returns true iff successful. - Mock::VerifyAndClearExpectations(host_); + Mock::VerifyAndClearExpectations(host_.get()); - EXPECT_CALL(*host_, OnStateChanged(kDeviceId, - VIDEO_CAPTURE_STATE_STOPPED)) + EXPECT_CALL(*host_.get(), + OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED)) .Times(AnyNumber()); // Simulate closing the IPC channel. @@ -247,21 +247,19 @@ class VideoCaptureHostTest : public testing::Test { void StartCapture() { InSequence s; // 1. First - get info about the new resolution - EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId)); + EXPECT_CALL(*host_.get(), OnDeviceInfo(kDeviceId)); // 2. Change state to started - EXPECT_CALL(*host_, OnStateChanged(kDeviceId, - VIDEO_CAPTURE_STATE_STARTED)); + EXPECT_CALL(*host_.get(), + OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STARTED)); // 3. Newly created buffers will arrive. - EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _)) - .Times(AnyNumber()) - .WillRepeatedly(Return()); + EXPECT_CALL(*host_.get(), OnNewBufferCreated(kDeviceId, _, _, _)) + .Times(AnyNumber()).WillRepeatedly(Return()); // 4. First filled buffer will arrive. - EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) - .Times(AnyNumber()) - .WillOnce(ExitMessageLoop(message_loop_.get())); + EXPECT_CALL(*host_.get(), OnBufferFilled(kDeviceId, _, _)) + .Times(AnyNumber()).WillOnce(ExitMessageLoop(message_loop_.get())); media::VideoCaptureParams params; params.width = 352; @@ -298,8 +296,8 @@ class VideoCaptureHostTest : public testing::Test { #endif void StopCapture() { - EXPECT_CALL(*host_, OnStateChanged(kDeviceId, - VIDEO_CAPTURE_STATE_STOPPED)) + EXPECT_CALL(*host_.get(), + OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED)) .WillOnce(ExitMessageLoop(message_loop_.get())); host_->OnStopCapture(kDeviceId); @@ -314,9 +312,8 @@ class VideoCaptureHostTest : public testing::Test { } void NotifyPacketReady() { - EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) - .Times(AnyNumber()) - .WillOnce(ExitMessageLoop(message_loop_.get())) + EXPECT_CALL(*host_.get(), OnBufferFilled(kDeviceId, _, _)) + .Times(AnyNumber()).WillOnce(ExitMessageLoop(message_loop_.get())) .RetiresOnSaturation(); message_loop_->Run(); } @@ -327,8 +324,8 @@ class VideoCaptureHostTest : public testing::Test { void SimulateError() { // Expect a change state to error state sent through IPC. - EXPECT_CALL(*host_, OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_ERROR)) - .Times(1); + EXPECT_CALL(*host_.get(), + OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_ERROR)).Times(1); VideoCaptureControllerID id(kDeviceId); host_->OnError(id); // Wait for the error callback. @@ -365,9 +362,8 @@ TEST_F(VideoCaptureHostTest, StartCaptureErrorStop) { } TEST_F(VideoCaptureHostTest, StartCaptureError) { - EXPECT_CALL(*host_, OnStateChanged(kDeviceId, - VIDEO_CAPTURE_STATE_STOPPED)) - .Times(0); + EXPECT_CALL(*host_.get(), + OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED)).Times(0); StartCapture(); NotifyPacketReady(); SimulateError(); diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index d722514..1f0b019 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc @@ -62,7 +62,7 @@ void VideoCaptureManager::Register(MediaStreamProviderListener* listener, base::MessageLoopProxy* device_thread_loop) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!listener_); - DCHECK(!device_loop_); + DCHECK(!device_loop_.get()); listener_ = listener; device_loop_ = device_thread_loop; } @@ -487,13 +487,14 @@ void VideoCaptureManager::DoAddControllerOnDeviceThread( Controllers::iterator cit = controllers_.find(video_capture_device); if (cit == controllers_.end()) { controller = new VideoCaptureController(this); - controllers_[video_capture_device] = new Controller(controller, handler); + controllers_[video_capture_device] = + new Controller(controller.get(), handler); } else { controllers_[video_capture_device]->handlers.push_front(handler); controller = controllers_[video_capture_device]->controller; } } - added_cb.Run(controller); + added_cb.Run(controller.get()); } void VideoCaptureManager::RemoveController( @@ -513,7 +514,7 @@ void VideoCaptureManager::DoRemoveControllerOnDeviceThread( for (Controllers::iterator cit = controllers_.begin(); cit != controllers_.end(); ++cit) { - if (controller == cit->second->controller) { + if (controller == cit->second->controller.get()) { Handlers& handlers = cit->second->handlers; for (Handlers::iterator hit = handlers.begin(); hit != handlers.end(); ++hit) { diff --git a/content/browser/renderer_host/media/web_contents_audio_input_stream.cc b/content/browser/renderer_host/media/web_contents_audio_input_stream.cc index 4e1928a..37afa5f 100644 --- a/content/browser/renderer_host/media/web_contents_audio_input_stream.cc +++ b/content/browser/renderer_host/media/web_contents_audio_input_stream.cc @@ -116,9 +116,9 @@ WebContentsAudioInputStream::Impl::Impl( target_render_process_id_(render_process_id), target_render_view_id_(render_view_id), callback_(NULL) { - DCHECK(message_loop_); + DCHECK(message_loop_.get()); DCHECK(mirroring_manager_); - DCHECK(tracker_); + DCHECK(tracker_.get()); DCHECK(mixer_stream_.get()); } @@ -237,7 +237,9 @@ media::AudioOutputStream* WebContentsAudioInputStream::Impl::AddInput( // guarantee the VirtualAudioInputStream (mixer_stream_) outlives the // VirtualAudioOutputStream. return new media::VirtualAudioOutputStream( - params, message_loop_, mixer_stream_.get(), + params, + message_loop_.get(), + mixer_stream_.get(), base::Bind(&Impl::ReleaseInput, this)); } diff --git a/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc b/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc index ffd9cbb..61b7308 100644 --- a/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc +++ b/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc @@ -209,13 +209,12 @@ class WebContentsAudioInputStreamTest : public testing::Test { ASSERT_EQ(kRenderProcessId, current_render_process_id_); ASSERT_EQ(kRenderViewId, current_render_view_id_); - EXPECT_CALL(*mock_tracker_, Start(kRenderProcessId, kRenderViewId, _)) + EXPECT_CALL(*mock_tracker_.get(), Start(kRenderProcessId, kRenderViewId, _)) .WillOnce(DoAll( - SaveArg<2>(&change_callback_), - WithArgs<0, 1>( - Invoke(&change_callback_, - &WebContentsTracker::ChangeCallback::Run)))); - EXPECT_CALL(*mock_tracker_, Stop()); // At Close() time. + SaveArg<2>(&change_callback_), + WithArgs<0, 1>(Invoke(&change_callback_, + &WebContentsTracker::ChangeCallback::Run)))); + EXPECT_CALL(*mock_tracker_.get(), Stop()); // At Close() time. wcais_ = new WebContentsAudioInputStream( current_render_process_id_, current_render_view_id_, diff --git a/content/browser/renderer_host/media/web_contents_tracker.cc b/content/browser/renderer_host/media/web_contents_tracker.cc index 68e76c5..a13dc12 100644 --- a/content/browser/renderer_host/media/web_contents_tracker.cc +++ b/content/browser/renderer_host/media/web_contents_tracker.cc @@ -20,10 +20,10 @@ WebContentsTracker::~WebContentsTracker() { void WebContentsTracker::Start(int render_process_id, int render_view_id, const ChangeCallback& callback) { - DCHECK(!message_loop_ || message_loop_->BelongsToCurrentThread()); + DCHECK(!message_loop_.get() || message_loop_->BelongsToCurrentThread()); message_loop_ = base::MessageLoopProxy::current(); - DCHECK(message_loop_); + DCHECK(message_loop_.get()); callback_ = callback; BrowserThread::PostTask( diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device.cc b/content/browser/renderer_host/media/web_contents_video_capture_device.cc index 0ec99a6..9fcd0ed 100644 --- a/content/browser/renderer_host/media/web_contents_video_capture_device.cc +++ b/content/browser/renderer_host/media/web_contents_video_capture_device.cc @@ -438,12 +438,14 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture( "paint")); // Consider the various reasons not to initiate a capture. - if (should_capture && !output_buffer) { - TRACE_EVENT_INSTANT1("mirroring", "EncodeLimited", + if (should_capture && !output_buffer.get()) { + TRACE_EVENT_INSTANT1("mirroring", + "EncodeLimited", TRACE_EVENT_SCOPE_THREAD, - "trigger", event_name); + "trigger", + event_name); return false; - } else if (!should_capture && output_buffer) { + } else if (!should_capture && output_buffer.get()) { if (content_is_dirty) { // This is a normal and acceptable way to drop a frame. We've hit our // capture rate limit: for example, the content is animating at 60fps but @@ -453,7 +455,7 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture( "trigger", event_name); } return false; - } else if (!should_capture && !output_buffer) { + } else if (!should_capture && !output_buffer.get()) { // We decided not to capture, but we wouldn't have been able to if we wanted // to because no output buffer was available. TRACE_EVENT_INSTANT1("mirroring", "NearlyEncodeLimited", @@ -686,7 +688,7 @@ void RenderVideoFrame(const SkBitmap& input, reinterpret_cast<uint8*>(scaled_bitmap.getPixels()), scaled_bitmap.rowBytes(), region_in_frame, - output); + output.get()); } // The result is now ready. @@ -740,8 +742,8 @@ scoped_ptr<CaptureMachine> CaptureMachine::Create( const scoped_refptr<base::SequencedTaskRunner>& render_task_runner, const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(render_task_runner); - DCHECK(oracle_proxy); + DCHECK(render_task_runner.get()); + DCHECK(oracle_proxy.get()); scoped_ptr<CaptureMachine> machine( new CaptureMachine(render_task_runner, oracle_proxy)); diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc index 304dc2e..58f2914 100644 --- a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc +++ b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc @@ -175,7 +175,8 @@ class CaptureTestView : public TestRenderWidgetHostView { const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(bool)>& callback) OVERRIDE { SkColor c = ConvertRgbToYuv(controller_->GetSolidColor()); - media::FillYUV(target, SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); + media::FillYUV( + target.get(), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); callback.Run(true); controller_->SignalCopy(); } @@ -197,9 +198,11 @@ class CaptureTestView : public TestRenderWidgetHostView { if (subscriber_ && subscriber_->ShouldCaptureFrame(present_time, &target, &callback)) { SkColor c = ConvertRgbToYuv(controller_->GetSolidColor()); - media::FillYUV(target, SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(callback, present_time, true)); + media::FillYUV( + target.get(), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); + BrowserThread::PostTask(BrowserThread::UI, + FROM_HERE, + base::Bind(callback, present_time, true)); controller_->SignalCopy(); } } @@ -447,7 +450,7 @@ class WebContentsVideoCaptureDeviceTest : public testing::Test { static_cast<SiteInstanceImpl*>(site_instance.get())-> set_render_process_host_factory(render_process_host_factory_.get()); web_contents_.reset( - TestWebContents::Create(browser_context_.get(), site_instance)); + TestWebContents::Create(browser_context_.get(), site_instance.get())); // This is actually a CaptureTestRenderViewHost. RenderWidgetHostImpl* rwh = diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc index 65d4c85..93b5b3b 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc @@ -112,7 +112,7 @@ void P2PSocketHostTcpBase::OnConnected(int result) { void P2PSocketHostTcpBase::DoRead() { int result; do { - if (!read_buffer_) { + if (!read_buffer_.get()) { read_buffer_ = new net::GrowableIOBuffer(); read_buffer_->SetCapacity(kReadBufferSize); } else if (read_buffer_->RemainingCapacity() < kReadBufferSize) { @@ -123,9 +123,10 @@ void P2PSocketHostTcpBase::DoRead() { read_buffer_->SetCapacity(read_buffer_->capacity() + kReadBufferSize - read_buffer_->RemainingCapacity()); } - result = socket_->Read(read_buffer_, read_buffer_->RemainingCapacity(), - base::Bind(&P2PSocketHostTcp::OnRead, - base::Unretained(this))); + result = socket_->Read( + read_buffer_.get(), + read_buffer_->RemainingCapacity(), + base::Bind(&P2PSocketHostTcp::OnRead, base::Unretained(this))); DidCompleteRead(result); } while (result > 0); } @@ -187,7 +188,7 @@ void P2PSocketHostTcpBase::Send(const net::IPEndPoint& to, void P2PSocketHostTcpBase::WriteOrQueue( scoped_refptr<net::DrainableIOBuffer>& buffer) { - if (write_buffer_) { + if (write_buffer_.get()) { write_queue_.push(buffer); return; } @@ -197,10 +198,11 @@ void P2PSocketHostTcpBase::WriteOrQueue( } void P2PSocketHostTcpBase::DoWrite() { - while (write_buffer_ && state_ == STATE_OPEN && !write_pending_) { - int result = socket_->Write(write_buffer_, write_buffer_->BytesRemaining(), - base::Bind(&P2PSocketHostTcp::OnWritten, - base::Unretained(this))); + while (write_buffer_.get() && state_ == STATE_OPEN && !write_pending_) { + int result = socket_->Write( + write_buffer_.get(), + write_buffer_->BytesRemaining(), + base::Bind(&P2PSocketHostTcp::OnWritten, base::Unretained(this))); HandleWriteResult(result); } } @@ -215,7 +217,7 @@ void P2PSocketHostTcpBase::OnWritten(int result) { } void P2PSocketHostTcpBase::HandleWriteResult(int result) { - DCHECK(write_buffer_); + DCHECK(write_buffer_.get()); if (result >= 0) { write_buffer_->DidConsume(result); if (write_buffer_->BytesRemaining() == 0) { diff --git a/content/browser/renderer_host/p2p/socket_host_udp.cc b/content/browser/renderer_host/p2p/socket_host_udp.cc index 402898cf..4aceadf 100644 --- a/content/browser/renderer_host/p2p/socket_host_udp.cc +++ b/content/browser/renderer_host/p2p/socket_host_udp.cc @@ -109,9 +109,11 @@ void P2PSocketHostUdp::OnError() { void P2PSocketHostUdp::DoRead() { int result; do { - result = socket_->RecvFrom(recv_buffer_, kReadBufferSize, &recv_address_, - base::Bind(&P2PSocketHostUdp::OnRecv, - base::Unretained(this))); + result = socket_->RecvFrom( + recv_buffer_.get(), + kReadBufferSize, + &recv_address_, + base::Bind(&P2PSocketHostUdp::OnRecv, base::Unretained(this))); if (result == net::ERR_IO_PENDING) return; HandleReadResult(result); @@ -181,17 +183,21 @@ void P2PSocketHostUdp::Send(const net::IPEndPoint& to, void P2PSocketHostUdp::DoSend(const PendingPacket& packet) { TRACE_EVENT_ASYNC_BEGIN2("p2p", "Udp::DoSend", this, "id", id_, "size", packet.size); - int result = socket_->SendTo(packet.data, packet.size, packet.to, - base::Bind(&P2PSocketHostUdp::OnSend, - base::Unretained(this))); + int result = socket_->SendTo( + packet.data.get(), + packet.size, + packet.to, + base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this))); // sendto() may return an error, e.g. if we've received an ICMP Destination // Unreachable message. When this happens try sending the same packet again, // and just drop it if it fails again. if (IsTransientError(result)) { - result = socket_->SendTo(packet.data, packet.size, packet.to, - base::Bind(&P2PSocketHostUdp::OnSend, - base::Unretained(this))); + result = socket_->SendTo( + packet.data.get(), + packet.size, + packet.to, + base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this))); } if (result == net::ERR_IO_PENDING) { diff --git a/content/browser/renderer_host/pepper/pepper_tcp_socket.cc b/content/browser/renderer_host/pepper/pepper_tcp_socket.cc index 3638898..a911c2c 100644 --- a/content/browser/renderer_host/pepper/pepper_tcp_socket.cc +++ b/content/browser/renderer_host/pepper/pepper_tcp_socket.cc @@ -168,9 +168,10 @@ void PepperTCPSocket::Read(int32 bytes_to_read) { } read_buffer_ = new net::IOBuffer(bytes_to_read); - int result = socket_->Read(read_buffer_, bytes_to_read, - base::Bind(&PepperTCPSocket::OnReadCompleted, - base::Unretained(this))); + int result = socket_->Read( + read_buffer_.get(), + bytes_to_read, + base::Bind(&PepperTCPSocket::OnReadCompleted, base::Unretained(this))); if (result != net::ERR_IO_PENDING) OnReadCompleted(result); } @@ -192,7 +193,8 @@ void PepperTCPSocket::Write(const std::string& data) { write_buffer_base_ = new net::IOBuffer(data_size); memcpy(write_buffer_base_->data(), data.data(), data_size); - write_buffer_ = new net::DrainableIOBuffer(write_buffer_base_, data_size); + write_buffer_ = + new net::DrainableIOBuffer(write_buffer_base_.get(), data_size); DoWrite(); } @@ -291,9 +293,9 @@ bool PepperTCPSocket::GetCertificateFields( ppapi::PPB_X509Certificate_Fields* fields) { scoped_refptr<net::X509Certificate> cert = net::X509Certificate::CreateFromBytes(der, length); - if (!cert) + if (!cert.get()) return false; - return GetCertificateFields(*cert, fields); + return GetCertificateFields(*cert.get(), fields); } void PepperTCPSocket::SendReadACKError() { @@ -314,8 +316,8 @@ void PepperTCPSocket::SendSSLHandshakeACK(bool succeeded) { static_cast<net::SSLClientSocket*>(socket_.get()); net::SSLInfo ssl_info; ssl_socket->GetSSLInfo(&ssl_info); - if (ssl_info.cert) - GetCertificateFields(*ssl_info.cert, &certificate_fields); + if (ssl_info.cert.get()) + GetCertificateFields(*ssl_info.cert.get(), &certificate_fields); } manager_->Send(new PpapiMsg_PPBTCPSocket_SSLHandshakeACK( routing_id_, @@ -443,9 +445,10 @@ void PepperTCPSocket::DoWrite() { DCHECK(write_buffer_.get()); DCHECK_GT(write_buffer_->BytesRemaining(), 0); - int result = socket_->Write(write_buffer_, write_buffer_->BytesRemaining(), - base::Bind(&PepperTCPSocket::OnWriteCompleted, - base::Unretained(this))); + int result = socket_->Write( + write_buffer_.get(), + write_buffer_->BytesRemaining(), + base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); if (result != net::ERR_IO_PENDING) OnWriteCompleted(result); } diff --git a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc b/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc index e6563cf..9095710 100644 --- a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc @@ -165,7 +165,7 @@ int32_t PepperUDPSocketPrivateMessageFilter::OnMsgRecvFrom( if (closed_) return PP_ERROR_FAILED; - if (recvfrom_buffer_) + if (recvfrom_buffer_.get()) return PP_ERROR_INPROGRESS; if (num_bytes > ppapi::proxy::UDPSocketPrivateResource::kMaxReadSize) { // |num_bytes| value is checked on the plugin side. @@ -174,9 +174,12 @@ int32_t PepperUDPSocketPrivateMessageFilter::OnMsgRecvFrom( } recvfrom_buffer_ = new net::IOBuffer(num_bytes); int result = socket_->RecvFrom( - recvfrom_buffer_, num_bytes, &recvfrom_address_, + recvfrom_buffer_.get(), + num_bytes, + &recvfrom_address_, base::Bind(&PepperUDPSocketPrivateMessageFilter::OnRecvFromCompleted, - this, context->MakeReplyMessageContext())); + this, + context->MakeReplyMessageContext())); if (result != net::ERR_IO_PENDING) OnRecvFromCompleted(context->MakeReplyMessageContext(), result); return PP_OK_COMPLETIONPENDING; @@ -263,7 +266,7 @@ void PepperUDPSocketPrivateMessageFilter::DoSendTo( return; } - if (sendto_buffer_) { + if (sendto_buffer_.get()) { SendSendToError(context, PP_ERROR_INPROGRESS); return; } @@ -292,8 +295,11 @@ void PepperUDPSocketPrivateMessageFilter::DoSendTo( } int result = socket_->SendTo( - sendto_buffer_, sendto_buffer_->size(), net::IPEndPoint(address, port), - base::Bind(&PepperUDPSocketPrivateMessageFilter::OnSendToCompleted, this, + sendto_buffer_.get(), + sendto_buffer_->size(), + net::IPEndPoint(address, port), + base::Bind(&PepperUDPSocketPrivateMessageFilter::OnSendToCompleted, + this, context)); if (result != net::ERR_IO_PENDING) OnSendToCompleted(context, result); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 1e8b640..c684d1b 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -310,7 +310,7 @@ RenderMessageFilter::RenderMessageFilter( render_process_id_(render_process_id), cpu_usage_(0), media_internals_(media_internals) { - DCHECK(request_context_); + DCHECK(request_context_.get()); render_widget_helper_->Init(render_process_id_, resource_dispatcher_host_); } @@ -468,7 +468,7 @@ void RenderMessageFilter::OnCreateWindow( // This will clone the sessionStorage for namespace_id_to_clone. scoped_refptr<SessionStorageNamespaceImpl> cloned_namespace = - new SessionStorageNamespaceImpl(dom_storage_context_, + new SessionStorageNamespaceImpl(dom_storage_context_.get(), params.session_storage_namespace_id); *cloned_session_storage_namespace_id = cloned_namespace->id(); @@ -478,7 +478,7 @@ void RenderMessageFilter::OnCreateWindow( route_id, main_frame_route_id, surface_id, - cloned_namespace); + cloned_namespace.get()); } void RenderMessageFilter::OnCreateWidget(int opener_id, @@ -912,9 +912,11 @@ void RenderMessageFilter::OnCacheableMetadataAvailable( const net::RequestPriority kPriority = net::LOW; scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(data.size())); memcpy(buf->data(), &data.front(), data.size()); - cache->WriteMetadata( - url, kPriority, - base::Time::FromDoubleT(expected_response_time), buf, data.size()); + cache->WriteMetadata(url, + kPriority, + base::Time::FromDoubleT(expected_response_time), + buf.get(), + data.size()); } void RenderMessageFilter::OnKeygen(uint32 key_size_index, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index c10a4f3..b5ef5fb 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -217,12 +217,12 @@ class RendererURLRequestContextSelector virtual net::URLRequestContext* GetRequestContext( ResourceType::Type resource_type) OVERRIDE { - net::URLRequestContextGetter* request_context = request_context_; + net::URLRequestContextGetter* request_context = request_context_.get(); // If the request has resource type of ResourceType::MEDIA, we use a request // context specific to media for handling it because these resources have // specific needs for caching. if (resource_type == ResourceType::MEDIA) - request_context = media_request_context_; + request_context = media_request_context_.get(); return request_context->GetURLRequestContext(); } @@ -561,7 +561,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { if (supports_browser_plugin_) { scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( new BrowserPluginMessageFilter(GetID(), IsGuest())); - channel_->AddFilter(bp_message_filter); + channel_->AddFilter(bp_message_filter.get()); } scoped_refptr<RenderMessageFilter> render_message_filter( @@ -574,10 +574,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { #endif GetBrowserContext(), GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), - widget_helper_, + widget_helper_.get(), media_internals, storage_partition_impl_->GetDOMStorageContext())); - channel_->AddFilter(render_message_filter); + channel_->AddFilter(render_message_filter.get()); BrowserContext* browser_context = GetBrowserContext(); ResourceContext* resource_context = browser_context->GetResourceContext(); @@ -611,12 +611,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), storage_partition_impl_->GetIndexedDBContext())); if (IsGuest()) { - if (!g_browser_plugin_geolocation_context.Get()) { + if (!g_browser_plugin_geolocation_context.Get().get()) { g_browser_plugin_geolocation_context.Get() = new BrowserPluginGeolocationPermissionContext(); } channel_->AddFilter(GeolocationDispatcherHost::New( - GetID(), g_browser_plugin_geolocation_context.Get())); + GetID(), g_browser_plugin_geolocation_context.Get().get())); } else { channel_->AddFilter(GeolocationDispatcherHost::New( GetID(), browser_context->GetGeolocationPermissionContext())); @@ -625,7 +625,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { channel_->AddFilter(gpu_message_filter_); #if defined(ENABLE_WEBRTC) peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); - channel_->AddFilter(peer_connection_tracker_host_); + channel_->AddFilter(peer_connection_tracker_host_.get()); channel_->AddFilter(new MediaStreamDispatcherHost(GetID())); #endif #if defined(ENABLE_PLUGINS) diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index e6b59ba..73dd8d9 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -188,8 +188,8 @@ RenderViewHostImpl::RenderViewHostImpl( static_cast<SessionStorageNamespaceImpl*>(session_storage)), save_accessibility_tree_for_testing_(false), render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { - DCHECK(session_storage_namespace_); - DCHECK(instance_); + DCHECK(session_storage_namespace_.get()); + DCHECK(instance_.get()); CHECK(delegate_); // http://crbug.com/82827 if (main_frame_routing_id == MSG_ROUTING_NONE) @@ -226,7 +226,7 @@ RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { } SiteInstance* RenderViewHostImpl::GetSiteInstance() const { - return instance_; + return instance_.get(); } bool RenderViewHostImpl::CreateRenderView( diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index edf39ea..58a04ce 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -69,7 +69,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, NoScriptAccessAfterSwapOut) { // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Open a same-site link in a new window. ShellAddedObserver new_shell_observer; @@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a rel=noreferrer + target=blank link. ShellAddedObserver new_shell_observer; @@ -190,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a same-site rel=noreferrer + target=foo link. ShellAddedObserver new_shell_observer; @@ -243,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a target=blank link. ShellAddedObserver new_shell_observer; @@ -291,7 +291,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a rel=noreferrer link. bool success = false; @@ -359,7 +359,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a target=foo link. ShellAddedObserver new_shell_observer; @@ -442,7 +442,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a target=_blank link. ShellAddedObserver new_shell_observer; @@ -545,10 +545,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, WebContents* opener_contents = shell()->web_contents(); scoped_refptr<SiteInstance> orig_site_instance( opener_contents->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); - RenderViewHostManager* opener_manager = - static_cast<WebContentsImpl*>(opener_contents)-> - GetRenderManagerForTesting(); + EXPECT_TRUE(orig_site_instance.get() != NULL); + RenderViewHostManager* opener_manager = static_cast<WebContentsImpl*>( + opener_contents)->GetRenderManagerForTesting(); // 1) Open two more windows, one named. These initially have openers but no // reference to each other. We will later post a message between them. @@ -595,8 +594,10 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // We now have three windows. The opener should have a swapped out RVH // for the new SiteInstance, but the _blank window should not. EXPECT_EQ(3u, Shell::windows().size()); - EXPECT_TRUE(opener_manager->GetSwappedOutRenderViewHost(foo_site_instance)); - EXPECT_FALSE(new_manager->GetSwappedOutRenderViewHost(foo_site_instance)); + EXPECT_TRUE( + opener_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); + EXPECT_FALSE( + new_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); // 2) Fail to post a message from the foo window to the opener if the target // origin is wrong. We won't see an error, but we can check for the right @@ -607,7 +608,8 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, " 'http://google.com'));", &success)); EXPECT_TRUE(success); - ASSERT_FALSE(opener_manager->GetSwappedOutRenderViewHost(orig_site_instance)); + ASSERT_FALSE( + opener_manager->GetSwappedOutRenderViewHost(orig_site_instance.get())); // 3) Post a message from the foo window to the opener. The opener will // reply, causing the foo window to update its own title. @@ -619,7 +621,8 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, "window.domAutomationController.send(postToOpener('msg','*'));", &success)); EXPECT_TRUE(success); - ASSERT_FALSE(opener_manager->GetSwappedOutRenderViewHost(orig_site_instance)); + ASSERT_FALSE( + opener_manager->GetSwappedOutRenderViewHost(orig_site_instance.get())); title_observer.Wait(); // We should have received only 1 message in the opener and "foo" tabs, @@ -653,7 +656,8 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // This postMessage should have created a swapped out RVH for the new // SiteInstance in the target=_blank window. - EXPECT_TRUE(new_manager->GetSwappedOutRenderViewHost(foo_site_instance)); + EXPECT_TRUE( + new_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); // TODO(nasko): Test subframe targeting of postMessage once // http://crbug.com/153701 is fixed. @@ -683,7 +687,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, WebContents* orig_contents = shell()->web_contents(); scoped_refptr<SiteInstance> orig_site_instance( orig_contents->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a target=foo link. ShellAddedObserver new_shell_observer; @@ -753,7 +757,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Test clicking a target=foo link. ShellAddedObserver new_shell_observer; @@ -821,7 +825,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( shell()->web_contents()->GetSiteInstance()); - EXPECT_TRUE(orig_site_instance != NULL); + EXPECT_TRUE(orig_site_instance.get() != NULL); // Load a cross-site page that fails with a 204 error. NavigateToURL(shell(), https_server.GetURL("nocontent")); diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index 9d6a4be..f91695c 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc @@ -63,7 +63,7 @@ RenderWidgetHelper::BackingStoreMsgProxy::BackingStoreMsgProxy( RenderWidgetHelper::BackingStoreMsgProxy::~BackingStoreMsgProxy() { // If the paint message was never dispatched, then we need to let the // helper know that we are going away. - if (!cancelled_ && helper_) + if (!cancelled_ && helper_.get()) helper_->OnDiscardBackingStoreMsg(this); } diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 4a6de28..c12d592 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc @@ -392,12 +392,13 @@ IN_PROC_BROWSER_TEST_F(CompositingRenderWidgetHostViewBrowserTest, CopyTwice) { base::RunLoop run_loop; scoped_refptr<media::VideoFrame> first_output = media::VideoFrame::CreateBlackFrame(frame_size()); - ASSERT_TRUE(first_output); + ASSERT_TRUE(first_output.get()); scoped_refptr<media::VideoFrame> second_output = media::VideoFrame::CreateBlackFrame(frame_size()); - ASSERT_TRUE(second_output); + ASSERT_TRUE(second_output.get()); view->CopyFromCompositingSurfaceToVideoFrame( - gfx::Rect(view->GetViewBounds().size()), first_output, + gfx::Rect(view->GetViewBounds().size()), + first_output, base::Bind(&RenderWidgetHostViewBrowserTest::FrameDelivered, base::Unretained(this), base::MessageLoopProxy::current(), diff --git a/content/browser/renderer_host/smooth_scroll_gesture_controller.cc b/content/browser/renderer_host/smooth_scroll_gesture_controller.cc index 3e8fcc1..a1f1934 100644 --- a/content/browser/renderer_host/smooth_scroll_gesture_controller.cc +++ b/content/browser/renderer_host/smooth_scroll_gesture_controller.cc @@ -30,7 +30,7 @@ SmoothScrollGestureController::~SmoothScrollGestureController() { void SmoothScrollGestureController::BeginSmoothScroll( RenderWidgetHostViewPort* view, const ViewHostMsg_BeginSmoothScroll_Params& params) { - if (pending_smooth_scroll_gesture_) + if (pending_smooth_scroll_gesture_.get()) return; rwh_ = view->GetRenderWidgetHost(); diff --git a/content/browser/renderer_host/socket_stream_host.cc b/content/browser/renderer_host/socket_stream_host.cc index 405a2b7..2d42089 100644 --- a/content/browser/renderer_host/socket_stream_host.cc +++ b/content/browser/renderer_host/socket_stream_host.cc @@ -67,33 +67,33 @@ void SocketStreamHost::Connect(const GURL& url, bool SocketStreamHost::SendData(const std::vector<char>& data) { VLOG(1) << "SocketStreamHost::SendData"; - return socket_ && socket_->SendData(&data[0], data.size()); + return socket_.get() && socket_->SendData(&data[0], data.size()); } void SocketStreamHost::Close() { VLOG(1) << "SocketStreamHost::Close"; - if (!socket_) + if (!socket_.get()) return; socket_->Close(); } void SocketStreamHost::CancelWithError(int error) { VLOG(1) << "SocketStreamHost::CancelWithError: error=" << error; - if (!socket_) + if (!socket_.get()) return; socket_->CancelWithError(error); } void SocketStreamHost::CancelWithSSLError(const net::SSLInfo& ssl_info) { VLOG(1) << "SocketStreamHost::CancelWithSSLError"; - if (!socket_) + if (!socket_.get()) return; socket_->CancelWithSSLError(ssl_info); } void SocketStreamHost::ContinueDespiteError() { VLOG(1) << "SocketStreamHost::ContinueDespiteError"; - if (!socket_) + if (!socket_.get()) return; socket_->ContinueDespiteError(); } |