summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-28 06:36:15 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-28 06:36:15 +0000
commit69d5c51f4e36b7de5e89a2eab2d1fd179e4f4a27 (patch)
tree26e7e6c146725e92e66e1226a727add18fa563bc /content/renderer
parent355b853894c91bc1822d0737d55a5883d865d839 (diff)
downloadchromium_src-69d5c51f4e36b7de5e89a2eab2d1fd179e4f4a27.zip
chromium_src-69d5c51f4e36b7de5e89a2eab2d1fd179e4f4a27.tar.gz
chromium_src-69d5c51f4e36b7de5e89a2eab2d1fd179e4f4a27.tar.bz2
RefCounted types should not have public destructors, content/browser part 2
BUG=123295 TEST=none TBR=brettw Review URL: https://chromiumcodereview.appspot.com/10071038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/devtools_agent_filter.cc25
-rw-r--r--content/renderer/devtools_agent_filter.h13
-rw-r--r--content/renderer/gpu/compositor_thread.cc10
-rw-r--r--content/renderer/media/audio_input_device.cc174
-rw-r--r--content/renderer/media/audio_input_device.h6
-rw-r--r--content/renderer/media/audio_input_message_filter.h7
-rw-r--r--content/renderer/media/audio_message_filter.cc20
-rw-r--r--content/renderer/media/audio_message_filter.h15
-rw-r--r--content/renderer/media/capture_video_decoder.cc104
-rw-r--r--content/renderer/media/capture_video_decoder.h4
-rw-r--r--content/renderer/media/capture_video_decoder_unittest.cc5
-rw-r--r--content/renderer/media/media_stream_impl.cc5
-rw-r--r--content/renderer/media/media_stream_impl.h1
-rw-r--r--content/renderer/media/render_audiosourceprovider.cc99
-rw-r--r--content/renderer/media/render_audiosourceprovider.h8
-rw-r--r--content/renderer/media/rtc_video_decoder.cc50
-rw-r--r--content/renderer/media/rtc_video_decoder.h4
-rw-r--r--content/renderer/media/video_capture_impl_manager.cc12
-rw-r--r--content/renderer/media/video_capture_impl_manager.h8
-rw-r--r--content/renderer/media/video_capture_impl_unittest.cc4
-rw-r--r--content/renderer/media/video_capture_message_filter.cc65
-rw-r--r--content/renderer/media/video_capture_message_filter.h18
-rw-r--r--content/renderer/p2p/p2p_transport_impl_unittest.cc10
-rw-r--r--content/renderer/p2p/socket_dispatcher.cc3
-rw-r--r--content/renderer/pepper/pepper_platform_audio_input_impl.cc156
-rw-r--r--content/renderer/pepper/pepper_platform_audio_input_impl.h23
-rw-r--r--content/renderer/pepper/pepper_platform_audio_output_impl.cc83
-rw-r--r--content/renderer/pepper/pepper_platform_audio_output_impl.h19
-rw-r--r--content/renderer/pepper/pepper_platform_video_capture_impl.cc22
-rw-r--r--content/renderer/pepper/pepper_platform_video_capture_impl.h4
-rw-r--r--content/renderer/plugin_channel_host.cc5
-rw-r--r--content/renderer/render_widget_fullscreen.cc32
-rw-r--r--content/renderer/render_widget_fullscreen.h6
-rw-r--r--content/renderer/renderer_main.cc7
34 files changed, 529 insertions, 498 deletions
diff --git a/content/renderer/devtools_agent_filter.cc b/content/renderer/devtools_agent_filter.cc
index 4e42ce3..312e599 100644
--- a/content/renderer/devtools_agent_filter.cc
+++ b/content/renderer/devtools_agent_filter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,7 +21,8 @@ class MessageImpl : public WebDevToolsAgent::MessageDescriptor {
public:
MessageImpl(const std::string& message, int host_id)
: msg(message),
- host_id(host_id) {}
+ host_id(host_id) {
+ }
virtual ~MessageImpl() {}
virtual WebDevToolsAgent* agent() {
DevToolsAgent* agent = DevToolsAgent::FromHostId(host_id);
@@ -35,25 +36,21 @@ class MessageImpl : public WebDevToolsAgent::MessageDescriptor {
int host_id;
};
-}
+// Made static to allow DevToolsAgent to use it for replying directly
+// from IO thread.
+int g_current_routing_id = 0;
-// static
-IPC::Channel* DevToolsAgentFilter::channel_ = NULL;
-// static
-int DevToolsAgentFilter::current_routing_id_ = 0;
+} // namespace
DevToolsAgentFilter::DevToolsAgentFilter()
: message_handled_(false),
render_thread_loop_(MessageLoop::current()) {
}
-DevToolsAgentFilter::~DevToolsAgentFilter() {
-}
-
bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
// Dispatch debugger commands directly from IO.
message_handled_ = true;
- current_routing_id_ = message.routing_id();
+ g_current_routing_id = message.routing_id();
IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
OnDispatchOnInspectorBackend)
@@ -62,9 +59,7 @@ bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
return message_handled_;
}
-void DevToolsAgentFilter::OnFilterAdded(IPC::Channel* channel) {
- channel_ = channel;
-}
+DevToolsAgentFilter::~DevToolsAgentFilter() {}
void DevToolsAgentFilter::OnDispatchOnInspectorBackend(
const std::string& message) {
@@ -74,7 +69,7 @@ void DevToolsAgentFilter::OnDispatchOnInspectorBackend(
return;
}
WebDevToolsAgent::interruptAndDispatch(
- new MessageImpl(message, current_routing_id_));
+ new MessageImpl(message, g_current_routing_id));
render_thread_loop_->PostTask(
FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages));
diff --git a/content/renderer/devtools_agent_filter.h b/content/renderer/devtools_agent_filter.h
index 217827e..767291e 100644
--- a/content/renderer/devtools_agent_filter.h
+++ b/content/renderer/devtools_agent_filter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,26 +23,21 @@ class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter {
public:
// There is a single instance of this class instantiated by the RenderThread.
DevToolsAgentFilter();
- virtual ~DevToolsAgentFilter();
static void SendRpcMessage(const DevToolsMessageData& data);
- private:
// IPC::ChannelProxy::MessageFilter override. Called on IO thread.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
+ protected:
+ virtual ~DevToolsAgentFilter();
+ private:
void OnDispatchOnInspectorBackend(const std::string& message);
bool message_handled_;
MessageLoop* render_thread_loop_;
- // Made static to allow DevToolsAgent to use it for replying directly
- // from IO thread.
- static int current_routing_id_;
- static IPC::Channel* channel_;
-
DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter);
};
diff --git a/content/renderer/gpu/compositor_thread.cc b/content/renderer/gpu/compositor_thread.cc
index 665ae33..8cbe079 100644
--- a/content/renderer/gpu/compositor_thread.cc
+++ b/content/renderer/gpu/compositor_thread.cc
@@ -42,10 +42,6 @@ class CompositorThread::InputHandlerWrapper
render_view_impl_, params));
}
- virtual ~InputHandlerWrapper() {
- input_handler_->setClient(NULL);
- }
-
int routing_id() const { return routing_id_; }
WebKit::WebCompositorInputHandler* input_handler() const {
return input_handler_;
@@ -66,6 +62,12 @@ class CompositorThread::InputHandlerWrapper
}
private:
+ friend class base::RefCountedThreadSafe<InputHandlerWrapper>;
+
+ virtual ~InputHandlerWrapper() {
+ input_handler_->setClient(NULL);
+ }
+
CompositorThread* compositor_thread_;
int routing_id_;
WebKit::WebCompositorInputHandler* input_handler_;
diff --git a/content/renderer/media/audio_input_device.cc b/content/renderer/media/audio_input_device.cc
index 09c0ba7..8dcf8d7 100644
--- a/content/renderer/media/audio_input_device.cc
+++ b/content/renderer/media/audio_input_device.cc
@@ -52,10 +52,10 @@ AudioInputDevice::AudioInputDevice(const media::AudioParameters& params,
filter_ = RenderThreadImpl::current()->audio_input_message_filter();
}
-AudioInputDevice::~AudioInputDevice() {
- // TODO(henrika): The current design requires that the user calls
- // Stop before deleting this class.
- CHECK_EQ(0, stream_id_);
+void AudioInputDevice::SetDevice(int session_id) {
+ DVLOG(1) << "SetDevice (session_id=" << session_id << ")";
+ message_loop()->PostTask(FROM_HERE,
+ base::Bind(&AudioInputDevice::SetSessionIdOnIOThread, this, session_id));
}
void AudioInputDevice::Start() {
@@ -64,12 +64,6 @@ void AudioInputDevice::Start() {
base::Bind(&AudioInputDevice::InitializeOnIOThread, this));
}
-void AudioInputDevice::SetDevice(int session_id) {
- DVLOG(1) << "SetDevice (session_id=" << session_id << ")";
- message_loop()->PostTask(FROM_HERE,
- base::Bind(&AudioInputDevice::SetSessionIdOnIOThread, this, session_id));
-}
-
void AudioInputDevice::Stop() {
DVLOG(1) << "Stop()";
@@ -104,83 +98,6 @@ void AudioInputDevice::SetAutomaticGainControl(bool enabled) {
this, enabled));
}
-void AudioInputDevice::InitializeOnIOThread() {
- DCHECK(message_loop()->BelongsToCurrentThread());
- // Make sure we don't call Start() more than once.
- DCHECK_EQ(0, stream_id_);
- if (stream_id_)
- return;
-
- stream_id_ = filter_->AddDelegate(this);
- // If |session_id_| is not specified, it will directly create the stream;
- // otherwise it will send a AudioInputHostMsg_StartDevice msg to the browser
- // and create the stream when getting a OnDeviceReady() callback.
- if (!session_id_) {
- Send(new AudioInputHostMsg_CreateStream(
- stream_id_, audio_parameters_,
- media::AudioManagerBase::kDefaultDeviceId,
- agc_is_enabled_));
- } else {
- Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id_));
- pending_device_ready_ = true;
- }
-}
-
-void AudioInputDevice::SetSessionIdOnIOThread(int session_id) {
- DCHECK(message_loop()->BelongsToCurrentThread());
- session_id_ = session_id;
-}
-
-void AudioInputDevice::StartOnIOThread() {
- DCHECK(message_loop()->BelongsToCurrentThread());
- if (stream_id_)
- Send(new AudioInputHostMsg_RecordStream(stream_id_));
-}
-
-void AudioInputDevice::ShutDownOnIOThread() {
- DCHECK(message_loop()->BelongsToCurrentThread());
- // NOTE: |completion| may be NULL.
- // Make sure we don't call shutdown more than once.
- if (stream_id_) {
- filter_->RemoveDelegate(stream_id_);
- Send(new AudioInputHostMsg_CloseStream(stream_id_));
-
- stream_id_ = 0;
- session_id_ = 0;
- pending_device_ready_ = false;
- agc_is_enabled_ = false;
- }
-
- // We can run into an issue where ShutDownOnIOThread is called right after
- // OnStreamCreated is called in cases where Start/Stop are called before we
- // get the OnStreamCreated callback. To handle that corner case, we call
- // Stop(). In most cases, the thread will already be stopped.
- // Another situation is when the IO thread goes away before Stop() is called
- // in which case, we cannot use the message loop to close the thread handle
- // and can't not rely on the main thread existing either.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- audio_thread_.Stop(NULL);
- audio_callback_.reset();
-}
-
-void AudioInputDevice::SetVolumeOnIOThread(double volume) {
- DCHECK(message_loop()->BelongsToCurrentThread());
- if (stream_id_)
- Send(new AudioInputHostMsg_SetVolume(stream_id_, volume));
-}
-
-void AudioInputDevice::SetAutomaticGainControlOnIOThread(bool enabled) {
- DCHECK(message_loop()->BelongsToCurrentThread());
- DCHECK_EQ(0, stream_id_) <<
- "The AGC state can not be modified while capturing is active.";
- if (stream_id_)
- return;
-
- // We simply store the new AGC setting here. This value will be used when
- // a new stream is initialized and by GetAutomaticGainControl().
- agc_is_enabled_ = enabled;
-}
-
void AudioInputDevice::OnStreamCreated(
base::SharedMemoryHandle handle,
base::SyncSocket::Handle socket_handle,
@@ -287,6 +204,89 @@ void AudioInputDevice::OnDeviceReady(const std::string& device_id) {
event_handler_->OnDeviceStarted(device_id);
}
+AudioInputDevice::~AudioInputDevice() {
+ // TODO(henrika): The current design requires that the user calls
+ // Stop before deleting this class.
+ CHECK_EQ(0, stream_id_);
+}
+
+void AudioInputDevice::InitializeOnIOThread() {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ // Make sure we don't call Start() more than once.
+ DCHECK_EQ(0, stream_id_);
+ if (stream_id_)
+ return;
+
+ stream_id_ = filter_->AddDelegate(this);
+ // If |session_id_| is not specified, it will directly create the stream;
+ // otherwise it will send a AudioInputHostMsg_StartDevice msg to the browser
+ // and create the stream when getting a OnDeviceReady() callback.
+ if (!session_id_) {
+ Send(new AudioInputHostMsg_CreateStream(
+ stream_id_, audio_parameters_,
+ media::AudioManagerBase::kDefaultDeviceId,
+ agc_is_enabled_));
+ } else {
+ Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id_));
+ pending_device_ready_ = true;
+ }
+}
+
+void AudioInputDevice::SetSessionIdOnIOThread(int session_id) {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ session_id_ = session_id;
+}
+
+void AudioInputDevice::StartOnIOThread() {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ if (stream_id_)
+ Send(new AudioInputHostMsg_RecordStream(stream_id_));
+}
+
+void AudioInputDevice::ShutDownOnIOThread() {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ // NOTE: |completion| may be NULL.
+ // Make sure we don't call shutdown more than once.
+ if (stream_id_) {
+ filter_->RemoveDelegate(stream_id_);
+ Send(new AudioInputHostMsg_CloseStream(stream_id_));
+
+ stream_id_ = 0;
+ session_id_ = 0;
+ pending_device_ready_ = false;
+ agc_is_enabled_ = false;
+ }
+
+ // We can run into an issue where ShutDownOnIOThread is called right after
+ // OnStreamCreated is called in cases where Start/Stop are called before we
+ // get the OnStreamCreated callback. To handle that corner case, we call
+ // Stop(). In most cases, the thread will already be stopped.
+ // Another situation is when the IO thread goes away before Stop() is called
+ // in which case, we cannot use the message loop to close the thread handle
+ // and can't not rely on the main thread existing either.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ audio_thread_.Stop(NULL);
+ audio_callback_.reset();
+}
+
+void AudioInputDevice::SetVolumeOnIOThread(double volume) {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ if (stream_id_)
+ Send(new AudioInputHostMsg_SetVolume(stream_id_, volume));
+}
+
+void AudioInputDevice::SetAutomaticGainControlOnIOThread(bool enabled) {
+ DCHECK(message_loop()->BelongsToCurrentThread());
+ DCHECK_EQ(0, stream_id_) <<
+ "The AGC state can not be modified while capturing is active.";
+ if (stream_id_)
+ return;
+
+ // We simply store the new AGC setting here. This value will be used when
+ // a new stream is initialized and by GetAutomaticGainControl().
+ agc_is_enabled_ = enabled;
+}
+
void AudioInputDevice::Send(IPC::Message* message) {
filter_->Send(message);
}
diff --git a/content/renderer/media/audio_input_device.h b/content/renderer/media/audio_input_device.h
index 787dfad..b6751ee 100644
--- a/content/renderer/media/audio_input_device.h
+++ b/content/renderer/media/audio_input_device.h
@@ -121,7 +121,6 @@ class CONTENT_EXPORT AudioInputDevice
AudioInputDevice(const media::AudioParameters& params,
CaptureCallback* callback,
CaptureEventHandler* event_handler);
- virtual ~AudioInputDevice();
// Specify the |session_id| to query which device to use. This method is
// asynchronous/non-blocking.
@@ -166,7 +165,12 @@ class CONTENT_EXPORT AudioInputDevice
virtual void OnStateChanged(AudioStreamState state) OVERRIDE;
virtual void OnDeviceReady(const std::string& device_id) OVERRIDE;
+ protected:
+ virtual ~AudioInputDevice();
+
private:
+ friend class base::RefCountedThreadSafe<AudioInputDevice>;
+
// Methods called on IO thread ----------------------------------------------
// The following methods are tasks posted on the IO thread that needs to
// be executed on that thread. They interact with AudioInputMessageFilter and
diff --git a/content/renderer/media/audio_input_message_filter.h b/content/renderer/media/audio_input_message_filter.h
index a537e70..b2ec1f2 100644
--- a/content/renderer/media/audio_input_message_filter.h
+++ b/content/renderer/media/audio_input_message_filter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -20,7 +20,7 @@
#include "media/audio/audio_buffers_state.h"
class CONTENT_EXPORT AudioInputMessageFilter
- : public IPC::ChannelProxy::MessageFilter {
+ : public IPC::ChannelProxy::MessageFilter {
public:
class CONTENT_EXPORT Delegate {
public:
@@ -46,7 +46,6 @@ class CONTENT_EXPORT AudioInputMessageFilter
};
AudioInputMessageFilter();
- virtual ~AudioInputMessageFilter();
// Add a delegate to the map and return id of the entry.
int32 AddDelegate(Delegate* delegate);
@@ -58,6 +57,8 @@ class CONTENT_EXPORT AudioInputMessageFilter
bool Send(IPC::Message* message);
private:
+ virtual ~AudioInputMessageFilter();
+
// IPC::ChannelProxy::MessageFilter override. Called on IO thread.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
diff --git a/content/renderer/media/audio_message_filter.cc b/content/renderer/media/audio_message_filter.cc
index 4996ea9..65c41f3 100644
--- a/content/renderer/media/audio_message_filter.cc
+++ b/content/renderer/media/audio_message_filter.cc
@@ -16,8 +16,12 @@ AudioMessageFilter::AudioMessageFilter()
VLOG(1) << "AudioMessageFilter::AudioMessageFilter()";
}
-AudioMessageFilter::~AudioMessageFilter() {
- VLOG(1) << "AudioMessageFilter::~AudioMessageFilter()";
+int32 AudioMessageFilter::AddDelegate(Delegate* delegate) {
+ return delegates_.Add(delegate);
+}
+
+void AudioMessageFilter::RemoveDelegate(int32 id) {
+ delegates_.Remove(id);
}
bool AudioMessageFilter::Send(IPC::Message* message) {
@@ -63,6 +67,10 @@ void AudioMessageFilter::OnChannelClosing() {
channel_ = NULL;
}
+AudioMessageFilter::~AudioMessageFilter() {
+ VLOG(1) << "AudioMessageFilter::~AudioMessageFilter()";
+}
+
void AudioMessageFilter::OnStreamCreated(
int stream_id,
base::SharedMemoryHandle handle,
@@ -96,11 +104,3 @@ void AudioMessageFilter::OnStreamStateChanged(
}
delegate->OnStateChanged(state);
}
-
-int32 AudioMessageFilter::AddDelegate(Delegate* delegate) {
- return delegates_.Add(delegate);
-}
-
-void AudioMessageFilter::RemoveDelegate(int32 id) {
- delegates_.Remove(id);
-}
diff --git a/content/renderer/media/audio_message_filter.h b/content/renderer/media/audio_message_filter.h
index 8df9d3f..40faeab 100644
--- a/content/renderer/media/audio_message_filter.h
+++ b/content/renderer/media/audio_message_filter.h
@@ -38,7 +38,6 @@ class CONTENT_EXPORT AudioMessageFilter
};
AudioMessageFilter();
- virtual ~AudioMessageFilter();
// Add a delegate to the map and return id of the entry.
int32 AddDelegate(Delegate* delegate);
@@ -49,16 +48,19 @@ class CONTENT_EXPORT AudioMessageFilter
// Sends an IPC message using |channel_|.
bool Send(IPC::Message* message);
- private:
- FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Basic);
- FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Delegates);
-
// IPC::ChannelProxy::MessageFilter override. Called on IO thread.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
virtual void OnFilterRemoved() OVERRIDE;
virtual void OnChannelClosing() OVERRIDE;
+ protected:
+ virtual ~AudioMessageFilter();
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Basic);
+ FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Delegates);
+
// Received when browser process has created an audio output stream.
void OnStreamCreated(int stream_id, base::SharedMemoryHandle handle,
#if defined(OS_WIN)
@@ -73,9 +75,6 @@ class CONTENT_EXPORT AudioMessageFilter
// changed.
void OnStreamStateChanged(int stream_id, AudioStreamState state);
- // Notification of volume property of an audio output stream.
- void OnStreamVolume(int stream_id, double volume);
-
// A map of stream ids to delegates.
IDMap<Delegate> delegates_;
diff --git a/content/renderer/media/capture_video_decoder.cc b/content/renderer/media/capture_video_decoder.cc
index 211d0e8..72d2d1ba 100644
--- a/content/renderer/media/capture_video_decoder.cc
+++ b/content/renderer/media/capture_video_decoder.cc
@@ -31,35 +31,19 @@ CaptureVideoDecoder::CaptureVideoDecoder(
DCHECK(vc_manager);
}
-CaptureVideoDecoder::~CaptureVideoDecoder() {}
-
-void CaptureVideoDecoder::Initialize(
- media::DemuxerStream* demuxer_stream,
- const media::PipelineStatusCB& status_cb,
- const media::StatisticsCB& statistics_cb) {
- message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&CaptureVideoDecoder::InitializeOnDecoderThread,
- this, make_scoped_refptr(demuxer_stream),
- status_cb, statistics_cb));
-}
-
-void CaptureVideoDecoder::Read(const ReadCB& read_cb) {
+void CaptureVideoDecoder::Play(const base::Closure& callback) {
message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&CaptureVideoDecoder::ReadOnDecoderThread,
- this, read_cb));
-}
-
-const gfx::Size& CaptureVideoDecoder::natural_size() {
- return natural_size_;
+ base::Bind(&CaptureVideoDecoder::PlayOnDecoderThread,
+ this, callback));
}
-void CaptureVideoDecoder::Play(const base::Closure& callback) {
+void CaptureVideoDecoder::Seek(base::TimeDelta time,
+ const media::PipelineStatusCB& cb) {
message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&CaptureVideoDecoder::PlayOnDecoderThread,
- this, callback));
+ base::Bind(&CaptureVideoDecoder::SeekOnDecoderThread,
+ this, time, cb));
}
void CaptureVideoDecoder::Pause(const base::Closure& callback) {
@@ -83,12 +67,26 @@ void CaptureVideoDecoder::Stop(const base::Closure& callback) {
this, callback));
}
-void CaptureVideoDecoder::Seek(base::TimeDelta time,
- const media::PipelineStatusCB& cb) {
+void CaptureVideoDecoder::Initialize(
+ media::DemuxerStream* demuxer_stream,
+ const media::PipelineStatusCB& status_cb,
+ const media::StatisticsCB& statistics_cb) {
message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&CaptureVideoDecoder::SeekOnDecoderThread,
- this, time, cb));
+ base::Bind(&CaptureVideoDecoder::InitializeOnDecoderThread,
+ this, make_scoped_refptr(demuxer_stream),
+ status_cb, statistics_cb));
+}
+
+void CaptureVideoDecoder::Read(const ReadCB& read_cb) {
+ message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&CaptureVideoDecoder::ReadOnDecoderThread,
+ this, read_cb));
+}
+
+const gfx::Size& CaptureVideoDecoder::natural_size() {
+ return natural_size_;
}
void CaptureVideoDecoder::OnStarted(media::VideoCapture* capture) {
@@ -134,26 +132,7 @@ void CaptureVideoDecoder::OnDeviceInfoReceived(
this, capture, device_info));
}
-void CaptureVideoDecoder::InitializeOnDecoderThread(
- media::DemuxerStream* demuxer_stream,
- const media::PipelineStatusCB& status_cb,
- const media::StatisticsCB& statistics_cb) {
- DVLOG(1) << "InitializeOnDecoderThread";
- DCHECK(message_loop_proxy_->BelongsToCurrentThread());
-
- capture_engine_ = vc_manager_->AddDevice(video_stream_id_, this);
-
- statistics_cb_ = statistics_cb;
- status_cb.Run(media::PIPELINE_OK);
- state_ = kNormal;
- capture_engine_->StartCapture(this, capability_);
-}
-
-void CaptureVideoDecoder::ReadOnDecoderThread(const ReadCB& read_cb) {
- DCHECK(message_loop_proxy_->BelongsToCurrentThread());
- CHECK(read_cb_.is_null());
- read_cb_ = read_cb;
-}
+CaptureVideoDecoder::~CaptureVideoDecoder() {}
void CaptureVideoDecoder::PlayOnDecoderThread(const base::Closure& callback) {
DVLOG(1) << "PlayOnDecoderThread";
@@ -161,6 +140,16 @@ void CaptureVideoDecoder::PlayOnDecoderThread(const base::Closure& callback) {
callback.Run();
}
+void CaptureVideoDecoder::SeekOnDecoderThread(
+ base::TimeDelta time,
+ const media::PipelineStatusCB& cb) {
+ DVLOG(1) << "SeekOnDecoderThread";
+ DCHECK(message_loop_proxy_->BelongsToCurrentThread());
+
+ cb.Run(media::PIPELINE_OK);
+ state_ = kNormal;
+}
+
void CaptureVideoDecoder::PauseOnDecoderThread(const base::Closure& callback) {
DVLOG(1) << "PauseOnDecoderThread";
DCHECK(message_loop_proxy_->BelongsToCurrentThread());
@@ -188,14 +177,25 @@ void CaptureVideoDecoder::StopOnDecoderThread(const base::Closure& callback) {
capture_engine_->StopCapture(this);
}
-void CaptureVideoDecoder::SeekOnDecoderThread(
- base::TimeDelta time,
- const media::PipelineStatusCB& cb) {
- DVLOG(1) << "SeekOnDecoderThread";
+void CaptureVideoDecoder::InitializeOnDecoderThread(
+ media::DemuxerStream* demuxer_stream,
+ const media::PipelineStatusCB& status_cb,
+ const media::StatisticsCB& statistics_cb) {
+ DVLOG(1) << "InitializeOnDecoderThread";
DCHECK(message_loop_proxy_->BelongsToCurrentThread());
- cb.Run(media::PIPELINE_OK);
+ capture_engine_ = vc_manager_->AddDevice(video_stream_id_, this);
+
+ statistics_cb_ = statistics_cb;
+ status_cb.Run(media::PIPELINE_OK);
state_ = kNormal;
+ capture_engine_->StartCapture(this, capability_);
+}
+
+void CaptureVideoDecoder::ReadOnDecoderThread(const ReadCB& read_cb) {
+ DCHECK(message_loop_proxy_->BelongsToCurrentThread());
+ CHECK(read_cb_.is_null());
+ read_cb_ = read_cb;
}
void CaptureVideoDecoder::OnStoppedOnDecoderThread(
diff --git a/content/renderer/media/capture_video_decoder.h b/content/renderer/media/capture_video_decoder.h
index d4bbd25..cafd533f 100644
--- a/content/renderer/media/capture_video_decoder.h
+++ b/content/renderer/media/capture_video_decoder.h
@@ -30,7 +30,6 @@ class CONTENT_EXPORT CaptureVideoDecoder
media::VideoCaptureSessionId video_stream_id,
VideoCaptureImplManager* vc_manager,
const media::VideoCaptureCapability& capability);
- virtual ~CaptureVideoDecoder();
// Filter implementation.
virtual void Play(const base::Closure& callback) OVERRIDE;
@@ -61,6 +60,9 @@ class CONTENT_EXPORT CaptureVideoDecoder
media::VideoCapture* capture,
const media::VideoCaptureParams& device_info) OVERRIDE;
+ protected:
+ virtual ~CaptureVideoDecoder();
+
private:
friend class CaptureVideoDecoderTest;
diff --git a/content/renderer/media/capture_video_decoder_unittest.cc b/content/renderer/media/capture_video_decoder_unittest.cc
index dbc869e..c87bd56 100644
--- a/content/renderer/media/capture_video_decoder_unittest.cc
+++ b/content/renderer/media/capture_video_decoder_unittest.cc
@@ -52,7 +52,6 @@ class MockVideoCaptureImpl : public VideoCaptureImpl {
VideoCaptureMessageFilter* filter)
: VideoCaptureImpl(id, ml_proxy, filter) {
}
- virtual ~MockVideoCaptureImpl() {}
MOCK_METHOD2(StartCapture,
void(media::VideoCapture::EventHandler* handler,
@@ -67,7 +66,6 @@ class MockVideoCaptureImpl : public VideoCaptureImpl {
class MockVideoCaptureImplManager : public VideoCaptureImplManager {
public:
MockVideoCaptureImplManager() {}
- virtual ~MockVideoCaptureImplManager() {}
MOCK_METHOD2(AddDevice,
media::VideoCapture*(media::VideoCaptureSessionId id,
@@ -76,6 +74,9 @@ class MockVideoCaptureImplManager : public VideoCaptureImplManager {
void(media::VideoCaptureSessionId id,
media::VideoCapture::EventHandler* handler));
+ protected:
+ virtual ~MockVideoCaptureImplManager() {}
+
private:
DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureImplManager);
};
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index b2502ec..4add708 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -75,8 +75,7 @@ static std::string ExtractManagerStreamLabel(
return manager_label;
}
-
-int MediaStreamImpl::next_request_id_ = 0;
+static int g_next_request_id = 0;
MediaStreamImpl::MediaStreamImpl(
content::RenderView* render_view,
@@ -181,7 +180,7 @@ void MediaStreamImpl::requestUserMedia(
UMA_HISTOGRAM_COUNTS_100(kHistogramGetUserMedia, 1);
DCHECK(CalledOnValidThread());
DCHECK(!user_media_request.isNull());
- int request_id = next_request_id_++;
+ int request_id = g_next_request_id++;
bool audio = user_media_request.audio();
media_stream::StreamOptions::VideoOption video_option =
diff --git a/content/renderer/media/media_stream_impl.h b/content/renderer/media/media_stream_impl.h
index c949a64..1cd390b 100644
--- a/content/renderer/media/media_stream_impl.h
+++ b/content/renderer/media/media_stream_impl.h
@@ -201,7 +201,6 @@ class CONTENT_EXPORT MediaStreamImpl
talk_base::Thread* worker_thread_;
base::Thread chrome_worker_thread_;
- static int next_request_id_;
typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap;
MediaRequestMap user_media_requests_;
diff --git a/content/renderer/media/render_audiosourceprovider.cc b/content/renderer/media/render_audiosourceprovider.cc
index 81f99ce..10803f8 100644
--- a/content/renderer/media/render_audiosourceprovider.cc
+++ b/content/renderer/media/render_audiosourceprovider.cc
@@ -27,7 +27,53 @@ RenderAudioSourceProvider::RenderAudioSourceProvider()
default_sink_ = new AudioDevice();
}
-RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
+void RenderAudioSourceProvider::setClient(
+ WebKit::WebAudioSourceProviderClient* client) {
+ // Synchronize with other uses of client_ and default_sink_.
+ base::AutoLock auto_lock(sink_lock_);
+
+ if (client && client != client_) {
+ // Detach the audio renderer from normal playback.
+ default_sink_->Stop();
+
+ // The client will now take control by calling provideInput() periodically.
+ client_ = client;
+
+ if (is_initialized_) {
+ // The client needs to be notified of the audio format, if available.
+ // If the format is not yet available, we'll be notified later
+ // when Initialize() is called.
+
+ // Inform WebKit about the audio stream format.
+ client->setFormat(channels_, sample_rate_);
+ }
+ } else if (!client && client_) {
+ // Restore normal playback.
+ client_ = NULL;
+ // TODO(crogers): We should call default_sink_->Play() if we're
+ // in the playing state.
+ }
+}
+
+void RenderAudioSourceProvider::provideInput(
+ const WebVector<float*>& audio_data, size_t number_of_frames) {
+ DCHECK(client_);
+
+ if (renderer_ && is_initialized_ && is_running_) {
+ // Wrap WebVector as std::vector.
+ vector<float*> v(audio_data.size());
+ for (size_t i = 0; i < audio_data.size(); ++i)
+ v[i] = audio_data[i];
+
+ // TODO(crogers): figure out if we should volume scale here or in common
+ // WebAudio code. In any case we need to take care of volume.
+ renderer_->Render(v, number_of_frames, 0);
+ } else {
+ // Provide silence if the source is not running.
+ for (size_t i = 0; i < audio_data.size(); ++i)
+ memset(audio_data[i], 0, sizeof(float) * number_of_frames);
+ }
+}
void RenderAudioSourceProvider::Start() {
base::AutoLock auto_lock(sink_lock_);
@@ -79,7 +125,8 @@ void RenderAudioSourceProvider::GetVolume(double* volume) {
}
void RenderAudioSourceProvider::Initialize(
- const media::AudioParameters& params, RenderCallback* renderer) {
+ const media::AudioParameters& params,
+ RenderCallback* renderer) {
base::AutoLock auto_lock(sink_lock_);
CHECK(!is_initialized_);
renderer_ = renderer;
@@ -98,50 +145,4 @@ void RenderAudioSourceProvider::Initialize(
is_initialized_ = true;
}
-void RenderAudioSourceProvider::setClient(
- WebKit::WebAudioSourceProviderClient* client) {
- // Synchronize with other uses of client_ and default_sink_.
- base::AutoLock auto_lock(sink_lock_);
-
- if (client && client != client_) {
- // Detach the audio renderer from normal playback.
- default_sink_->Stop();
-
- // The client will now take control by calling provideInput() periodically.
- client_ = client;
-
- if (is_initialized_) {
- // The client needs to be notified of the audio format, if available.
- // If the format is not yet available, we'll be notified later
- // when Initialize() is called.
-
- // Inform WebKit about the audio stream format.
- client->setFormat(channels_, sample_rate_);
- }
- } else if (!client && client_) {
- // Restore normal playback.
- client_ = NULL;
- // TODO(crogers): We should call default_sink_->Play() if we're
- // in the playing state.
- }
-}
-
-void RenderAudioSourceProvider::provideInput(
- const WebVector<float*>& audio_data, size_t number_of_frames) {
- DCHECK(client_);
-
- if (renderer_ && is_initialized_ && is_running_) {
- // Wrap WebVector as std::vector.
- vector<float*> v(audio_data.size());
- for (size_t i = 0; i < audio_data.size(); ++i)
- v[i] = audio_data[i];
-
- // TODO(crogers): figure out if we should volume scale here or in common
- // WebAudio code. In any case we need to take care of volume.
- renderer_->Render(v, number_of_frames, 0);
- } else {
- // Provide silence if the source is not running.
- for (size_t i = 0; i < audio_data.size(); ++i)
- memset(audio_data[i], 0, sizeof(float) * number_of_frames);
- }
-}
+RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
diff --git a/content/renderer/media/render_audiosourceprovider.h b/content/renderer/media/render_audiosourceprovider.h
index f69c99d..ab4510f 100644
--- a/content/renderer/media/render_audiosourceprovider.h
+++ b/content/renderer/media/render_audiosourceprovider.h
@@ -38,7 +38,6 @@ class RenderAudioSourceProvider
public media::AudioRendererSink {
public:
RenderAudioSourceProvider();
- virtual ~RenderAudioSourceProvider();
// WebKit::WebAudioSourceProvider implementation.
@@ -60,8 +59,11 @@ class RenderAudioSourceProvider
virtual void SetPlaybackRate(float rate) OVERRIDE;
virtual bool SetVolume(double volume) OVERRIDE;
virtual void GetVolume(double* volume) OVERRIDE;
- virtual void Initialize(
- const media::AudioParameters& params, RenderCallback* renderer) OVERRIDE;
+ virtual void Initialize(const media::AudioParameters& params,
+ RenderCallback* renderer) OVERRIDE;
+
+ protected:
+ virtual ~RenderAudioSourceProvider();
private:
// Set to true when Initialize() is called.
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 42de408..ea15a02 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -36,37 +36,29 @@ RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop,
got_first_frame_(false) {
}
-RTCVideoDecoder::~RTCVideoDecoder() {}
-
-void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
- const PipelineStatusCB& status_cb,
- const StatisticsCB& statistics_cb) {
+void RTCVideoDecoder::Play(const base::Closure& callback) {
if (MessageLoop::current() != message_loop_) {
- message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&RTCVideoDecoder::Initialize, this,
- make_scoped_refptr(demuxer_stream),
- status_cb, statistics_cb));
+ message_loop_->PostTask(FROM_HERE,
+ base::Bind(&RTCVideoDecoder::Play, this, callback));
return;
}
DCHECK_EQ(MessageLoop::current(), message_loop_);
- state_ = kNormal;
- status_cb.Run(PIPELINE_OK);
- // TODO(acolwell): Implement stats.
+ callback.Run();
}
-void RTCVideoDecoder::Play(const base::Closure& callback) {
+void RTCVideoDecoder::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {
if (MessageLoop::current() != message_loop_) {
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&RTCVideoDecoder::Play, this, callback));
- return;
+ message_loop_->PostTask(FROM_HERE,
+ base::Bind(&RTCVideoDecoder::Seek, this,
+ time, cb));
+ return;
}
DCHECK_EQ(MessageLoop::current(), message_loop_);
-
- callback.Run();
+ state_ = kNormal;
+ cb.Run(PIPELINE_OK);
}
void RTCVideoDecoder::Pause(const base::Closure& callback) {
@@ -127,17 +119,23 @@ void RTCVideoDecoder::Stop(const base::Closure& callback) {
VideoDecoder::Stop(callback);
}
-void RTCVideoDecoder::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {
+void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
+ const PipelineStatusCB& status_cb,
+ const StatisticsCB& statistics_cb) {
if (MessageLoop::current() != message_loop_) {
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&RTCVideoDecoder::Seek, this,
- time, cb));
- return;
+ message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&RTCVideoDecoder::Initialize, this,
+ make_scoped_refptr(demuxer_stream),
+ status_cb, statistics_cb));
+ return;
}
DCHECK_EQ(MessageLoop::current(), message_loop_);
state_ = kNormal;
- cb.Run(PIPELINE_OK);
+ status_cb.Run(PIPELINE_OK);
+
+ // TODO(acolwell): Implement stats.
}
void RTCVideoDecoder::Read(const ReadCB& callback) {
@@ -219,3 +217,5 @@ bool RTCVideoDecoder::RenderFrame(const cricket::VideoFrame* frame) {
read_cb.Run(kOk, video_frame);
return true;
}
+
+RTCVideoDecoder::~RTCVideoDecoder() {}
diff --git a/content/renderer/media/rtc_video_decoder.h b/content/renderer/media/rtc_video_decoder.h
index 8d1f9c0..ca615431 100644
--- a/content/renderer/media/rtc_video_decoder.h
+++ b/content/renderer/media/rtc_video_decoder.h
@@ -28,7 +28,6 @@ class CONTENT_EXPORT RTCVideoDecoder
NON_EXPORTED_BASE(public cricket::VideoRenderer) {
public:
RTCVideoDecoder(MessageLoop* message_loop, const std::string& url);
- virtual ~RTCVideoDecoder();
// Filter implementation.
virtual void Play(const base::Closure& callback) OVERRIDE;
@@ -50,6 +49,9 @@ class CONTENT_EXPORT RTCVideoDecoder
virtual bool SetSize(int width, int height, int reserved) OVERRIDE;
virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE;
+ protected:
+ virtual ~RTCVideoDecoder();
+
private:
friend class RTCVideoDecoderTest;
FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful);
diff --git a/content/renderer/media/video_capture_impl_manager.cc b/content/renderer/media/video_capture_impl_manager.cc
index 5b5de3d..46ed2f5 100644
--- a/content/renderer/media/video_capture_impl_manager.cc
+++ b/content/renderer/media/video_capture_impl_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,11 +16,6 @@ VideoCaptureImplManager::VideoCaptureImplManager()
filter_ = new VideoCaptureMessageFilter();
}
-VideoCaptureImplManager::~VideoCaptureImplManager() {
- STLDeleteContainerPairSecondPointers(devices_.begin(), devices_.end());
- thread_.Stop();
-}
-
media::VideoCapture* VideoCaptureImplManager::AddDevice(
media::VideoCaptureSessionId id,
media::VideoCapture::EventHandler* handler) {
@@ -66,6 +61,11 @@ void VideoCaptureImplManager::FreeDevice(VideoCaptureImpl* vc) {
delete vc;
}
+VideoCaptureImplManager::~VideoCaptureImplManager() {
+ STLDeleteContainerPairSecondPointers(devices_.begin(), devices_.end());
+ thread_.Stop();
+}
+
VideoCaptureImplManager::Device::Device(
VideoCaptureImpl* device,
media::VideoCapture::EventHandler* handler)
diff --git a/content/renderer/media/video_capture_impl_manager.h b/content/renderer/media/video_capture_impl_manager.h
index 8427957f..0d3faa5 100644
--- a/content/renderer/media/video_capture_impl_manager.h
+++ b/content/renderer/media/video_capture_impl_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,7 +26,6 @@ class CONTENT_EXPORT VideoCaptureImplManager
: public base::RefCountedThreadSafe<VideoCaptureImplManager> {
public:
VideoCaptureImplManager();
- virtual ~VideoCaptureImplManager();
// Called by video capture client |handler| to add device referenced
// by |id| to VideoCaptureImplManager's list of opened device list.
@@ -45,7 +44,12 @@ class CONTENT_EXPORT VideoCaptureImplManager
return filter_;
}
+ protected:
+ virtual ~VideoCaptureImplManager();
+
private:
+ friend class base::RefCountedThreadSafe<VideoCaptureImplManager>;
+
struct Device {
Device(VideoCaptureImpl* device,
media::VideoCapture::EventHandler* handler);
diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc
index 47a76ad..24644e3 100644
--- a/content/renderer/media/video_capture_impl_unittest.cc
+++ b/content/renderer/media/video_capture_impl_unittest.cc
@@ -20,11 +20,13 @@ using ::testing::Return;
class MockVideoCaptureMessageFilter : public VideoCaptureMessageFilter {
public:
MockVideoCaptureMessageFilter() : VideoCaptureMessageFilter() {}
- virtual ~MockVideoCaptureMessageFilter() {}
// Filter implementation.
MOCK_METHOD1(Send, bool(IPC::Message* message));
+ protected:
+ virtual ~MockVideoCaptureMessageFilter() {}
+
private:
DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureMessageFilter);
};
diff --git a/content/renderer/media/video_capture_message_filter.cc b/content/renderer/media/video_capture_message_filter.cc
index 2ec4110..dabbcae 100644
--- a/content/renderer/media/video_capture_message_filter.cc
+++ b/content/renderer/media/video_capture_message_filter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,7 +12,35 @@ VideoCaptureMessageFilter::VideoCaptureMessageFilter()
channel_(NULL) {
}
-VideoCaptureMessageFilter::~VideoCaptureMessageFilter() {
+void VideoCaptureMessageFilter::AddDelegate(Delegate* delegate) {
+ if (++last_device_id_ <= 0)
+ last_device_id_ = 1;
+ while (delegates_.find(last_device_id_) != delegates_.end())
+ last_device_id_++;
+
+ if (channel_) {
+ delegates_[last_device_id_] = delegate;
+ delegate->OnDelegateAdded(last_device_id_);
+ } else {
+ pending_delegates_[last_device_id_] = delegate;
+ }
+}
+
+void VideoCaptureMessageFilter::RemoveDelegate(Delegate* delegate) {
+ for (Delegates::iterator it = delegates_.begin();
+ it != delegates_.end(); it++) {
+ if (it->second == delegate) {
+ delegates_.erase(it);
+ break;
+ }
+ }
+ for (Delegates::iterator it = pending_delegates_.begin();
+ it != pending_delegates_.end(); it++) {
+ if (it->second == delegate) {
+ pending_delegates_.erase(it);
+ break;
+ }
+ }
}
bool VideoCaptureMessageFilter::Send(IPC::Message* message) {
@@ -58,6 +86,8 @@ void VideoCaptureMessageFilter::OnChannelClosing() {
channel_ = NULL;
}
+VideoCaptureMessageFilter::~VideoCaptureMessageFilter() {}
+
void VideoCaptureMessageFilter::OnBufferCreated(
int device_id,
base::SharedMemoryHandle handle,
@@ -129,34 +159,3 @@ void VideoCaptureMessageFilter::OnDeviceInfoReceived(
}
delegate->OnDeviceInfoReceived(params);
}
-
-void VideoCaptureMessageFilter::AddDelegate(Delegate* delegate) {
- if (++last_device_id_ <= 0)
- last_device_id_ = 1;
- while (delegates_.find(last_device_id_) != delegates_.end())
- last_device_id_++;
-
- if (channel_) {
- delegates_[last_device_id_] = delegate;
- delegate->OnDelegateAdded(last_device_id_);
- } else {
- pending_delegates_[last_device_id_] = delegate;
- }
-}
-
-void VideoCaptureMessageFilter::RemoveDelegate(Delegate* delegate) {
- for (Delegates::iterator it = delegates_.begin();
- it != delegates_.end(); it++) {
- if (it->second == delegate) {
- delegates_.erase(it);
- break;
- }
- }
- for (Delegates::iterator it = pending_delegates_.begin();
- it != pending_delegates_.end(); it++) {
- if (it->second == delegate) {
- pending_delegates_.erase(it);
- break;
- }
- }
-}
diff --git a/content/renderer/media/video_capture_message_filter.h b/content/renderer/media/video_capture_message_filter.h
index 9edf742..ba597c4 100644
--- a/content/renderer/media/video_capture_message_filter.h
+++ b/content/renderer/media/video_capture_message_filter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -49,7 +49,6 @@ class CONTENT_EXPORT VideoCaptureMessageFilter
};
VideoCaptureMessageFilter();
- virtual ~VideoCaptureMessageFilter();
// Add a delegate to the map.
void AddDelegate(Delegate* delegate);
@@ -60,18 +59,21 @@ class CONTENT_EXPORT VideoCaptureMessageFilter
// Send a message asynchronously.
virtual bool Send(IPC::Message* message);
- private:
- FRIEND_TEST_ALL_PREFIXES(VideoCaptureMessageFilterTest, Basic);
- FRIEND_TEST_ALL_PREFIXES(VideoCaptureMessageFilterTest, Delegates);
-
- typedef std::map<int32, Delegate*> Delegates;
-
// IPC::ChannelProxy::MessageFilter override. Called on IO thread.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
virtual void OnFilterRemoved() OVERRIDE;
virtual void OnChannelClosing() OVERRIDE;
+ protected:
+ virtual ~VideoCaptureMessageFilter();
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(VideoCaptureMessageFilterTest, Basic);
+ FRIEND_TEST_ALL_PREFIXES(VideoCaptureMessageFilterTest, Delegates);
+
+ typedef std::map<int32, Delegate*> Delegates;
+
// Receive a newly created buffer from browser process.
void OnBufferCreated(int device_id,
base::SharedMemoryHandle handle,
diff --git a/content/renderer/p2p/p2p_transport_impl_unittest.cc b/content/renderer/p2p/p2p_transport_impl_unittest.cc
index 24d6ddc..0022ece 100644
--- a/content/renderer/p2p/p2p_transport_impl_unittest.cc
+++ b/content/renderer/p2p/p2p_transport_impl_unittest.cc
@@ -58,8 +58,6 @@ class UdpChannelTester : public base::RefCountedThreadSafe<UdpChannelTester> {
broken_packets_(0) {
}
- virtual ~UdpChannelTester() { }
-
void Start() {
message_loop_->PostTask(
FROM_HERE, base::Bind(&UdpChannelTester::DoStart, this));
@@ -78,6 +76,9 @@ class UdpChannelTester : public base::RefCountedThreadSafe<UdpChannelTester> {
}
protected:
+ friend class base::RefCountedThreadSafe<UdpChannelTester>;
+ virtual ~UdpChannelTester() {}
+
void Done() {
done_ = true;
message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
@@ -199,8 +200,6 @@ class TcpChannelTester : public base::RefCountedThreadSafe<TcpChannelTester> {
read_errors_(0) {
}
- virtual ~TcpChannelTester() { }
-
void Init() {
// Initialize |send_buffer_|.
send_buffer_ = new net::DrainableIOBuffer(new net::IOBuffer(kTcpDataSize),
@@ -233,6 +232,9 @@ class TcpChannelTester : public base::RefCountedThreadSafe<TcpChannelTester> {
}
protected:
+ friend class base::RefCountedThreadSafe<TcpChannelTester>;
+ virtual ~TcpChannelTester() {}
+
void Done() {
done_ = true;
message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
diff --git a/content/renderer/p2p/socket_dispatcher.cc b/content/renderer/p2p/socket_dispatcher.cc
index 4e90471..4317725 100644
--- a/content/renderer/p2p/socket_dispatcher.cc
+++ b/content/renderer/p2p/socket_dispatcher.cc
@@ -34,6 +34,9 @@ class P2PSocketDispatcher::AsyncMessageSender
}
private:
+ friend class base::RefCountedThreadSafe<AsyncMessageSender>;
+ ~AsyncMessageSender() {}
+
void DoSend(IPC::Message* msg) {
DCHECK(message_loop_->BelongsToCurrentThread());
if (message_sender_)
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.cc b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
index c69d562..effcf2a 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.cc
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
@@ -16,26 +16,6 @@
namespace content {
-PepperPlatformAudioInputImpl::PepperPlatformAudioInputImpl()
- : client_(NULL),
- stream_id_(0),
- main_message_loop_proxy_(base::MessageLoopProxy::current()),
- shutdown_called_(false) {
- filter_ = RenderThreadImpl::current()->audio_input_message_filter();
-}
-
-PepperPlatformAudioInputImpl::~PepperPlatformAudioInputImpl() {
- // Make sure we have been shut down. Warning: this may happen on the I/O
- // thread!
- // Although these members should be accessed on a specific thread (either the
- // main thread or the I/O thread), it should be fine to examine their value
- // here.
- DCHECK_EQ(0, stream_id_);
- DCHECK(!client_);
- DCHECK(label_.empty());
- DCHECK(shutdown_called_);
-}
-
// static
PepperPlatformAudioInputImpl* PepperPlatformAudioInputImpl::Create(
const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
@@ -81,6 +61,83 @@ void PepperPlatformAudioInputImpl::ShutDown() {
base::Bind(&PepperPlatformAudioInputImpl::ShutDownOnIOThread, this));
}
+void PepperPlatformAudioInputImpl::OnStreamCreated(
+ base::SharedMemoryHandle handle,
+ base::SyncSocket::Handle socket_handle,
+ uint32 length) {
+#if defined(OS_WIN)
+ DCHECK(handle);
+ DCHECK(socket_handle);
+#else
+ DCHECK_NE(-1, handle.fd);
+ DCHECK_NE(-1, socket_handle);
+#endif
+ DCHECK(length);
+
+ if (base::MessageLoopProxy::current() != main_message_loop_proxy_) {
+ // No need to check |shutdown_called_| here. If shutdown has occurred,
+ // |client_| will be NULL and the handles will be cleaned up on the main
+ // thread.
+ main_message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this,
+ handle, socket_handle, length));
+ } else {
+ // Must dereference the client only on the main thread. Shutdown may have
+ // occurred while the request was in-flight, so we need to NULL check.
+ if (client_) {
+ client_->StreamCreated(handle, length, socket_handle);
+ } else {
+ // Clean up the handles.
+ base::SyncSocket temp_socket(socket_handle);
+ base::SharedMemory temp_shared_memory(handle, false);
+ }
+ }
+}
+
+void PepperPlatformAudioInputImpl::OnVolume(double volume) {}
+
+void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) {}
+
+void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) {
+ DCHECK(ChildProcess::current()->io_message_loop_proxy()->
+ BelongsToCurrentThread());
+
+ if (shutdown_called_)
+ return;
+
+ if (device_id.empty()) {
+ main_message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&PepperPlatformAudioInputImpl::NotifyStreamCreationFailed,
+ this));
+ } else {
+ // We will be notified by OnStreamCreated().
+ filter_->Send(new AudioInputHostMsg_CreateStream(stream_id_, params_,
+ device_id, false));
+ }
+}
+
+PepperPlatformAudioInputImpl::~PepperPlatformAudioInputImpl() {
+ // Make sure we have been shut down. Warning: this may happen on the I/O
+ // thread!
+ // Although these members should be accessed on a specific thread (either the
+ // main thread or the I/O thread), it should be fine to examine their value
+ // here.
+ DCHECK_EQ(0, stream_id_);
+ DCHECK(!client_);
+ DCHECK(label_.empty());
+ DCHECK(shutdown_called_);
+}
+
+PepperPlatformAudioInputImpl::PepperPlatformAudioInputImpl()
+ : client_(NULL),
+ stream_id_(0),
+ main_message_loop_proxy_(base::MessageLoopProxy::current()),
+ shutdown_called_(false) {
+ filter_ = RenderThreadImpl::current()->audio_input_message_filter();
+}
+
bool PepperPlatformAudioInputImpl::Initialize(
const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
const std::string& device_id,
@@ -177,65 +234,6 @@ void PepperPlatformAudioInputImpl::ShutDownOnIOThread() {
// PepperPluginDelegateImpl::CreateAudioInput.
}
-void PepperPlatformAudioInputImpl::OnStreamCreated(
- base::SharedMemoryHandle handle,
- base::SyncSocket::Handle socket_handle,
- uint32 length) {
-#if defined(OS_WIN)
- DCHECK(handle);
- DCHECK(socket_handle);
-#else
- DCHECK_NE(-1, handle.fd);
- DCHECK_NE(-1, socket_handle);
-#endif
- DCHECK(length);
-
- if (base::MessageLoopProxy::current() != main_message_loop_proxy_) {
- // No need to check |shutdown_called_| here. If shutdown has occurred,
- // |client_| will be NULL and the handles will be cleaned up on the main
- // thread.
- main_message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this,
- handle, socket_handle, length));
- } else {
- // Must dereference the client only on the main thread. Shutdown may have
- // occurred while the request was in-flight, so we need to NULL check.
- if (client_) {
- client_->StreamCreated(handle, length, socket_handle);
- } else {
- // Clean up the handles.
- base::SyncSocket temp_socket(socket_handle);
- base::SharedMemory temp_shared_memory(handle, false);
- }
- }
-}
-
-void PepperPlatformAudioInputImpl::OnVolume(double volume) {
-}
-
-void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) {
-}
-
-void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) {
- DCHECK(ChildProcess::current()->io_message_loop_proxy()->
- BelongsToCurrentThread());
-
- if (shutdown_called_)
- return;
-
- if (device_id.empty()) {
- main_message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&PepperPlatformAudioInputImpl::NotifyStreamCreationFailed,
- this));
- } else {
- // We will be notified by OnStreamCreated().
- filter_->Send(new AudioInputHostMsg_CreateStream(stream_id_, params_,
- device_id, false));
- }
-}
-
void PepperPlatformAudioInputImpl::OnDeviceOpened(int request_id,
bool succeeded,
const std::string& label) {
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.h b/content/renderer/pepper/pepper_platform_audio_input_impl.h
index 4117fe4..6b6c3b41 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.h
@@ -36,8 +36,6 @@ class PepperPlatformAudioInputImpl
public AudioInputMessageFilter::Delegate,
public base::RefCountedThreadSafe<PepperPlatformAudioInputImpl> {
public:
- virtual ~PepperPlatformAudioInputImpl();
-
// Factory function, returns NULL on failure. StreamCreated() will be called
// when the stream is created.
static PepperPlatformAudioInputImpl* Create(
@@ -52,7 +50,20 @@ class PepperPlatformAudioInputImpl
virtual void StopCapture() OVERRIDE;
virtual void ShutDown() OVERRIDE;
+ // AudioInputMessageFilter::Delegate.
+ virtual void OnStreamCreated(base::SharedMemoryHandle handle,
+ base::SyncSocket::Handle socket_handle,
+ uint32 length) OVERRIDE;
+ virtual void OnVolume(double volume) OVERRIDE;
+ virtual void OnStateChanged(AudioStreamState state) OVERRIDE;
+ virtual void OnDeviceReady(const std::string&) OVERRIDE;
+
+ protected:
+ virtual ~PepperPlatformAudioInputImpl();
+
private:
+ friend class base::RefCountedThreadSafe<PepperPlatformAudioInputImpl>;
+
PepperPlatformAudioInputImpl();
bool Initialize(
@@ -68,14 +79,6 @@ class PepperPlatformAudioInputImpl
void StopCaptureOnIOThread();
void ShutDownOnIOThread();
- // AudioInputMessageFilter::Delegate.
- virtual void OnStreamCreated(base::SharedMemoryHandle handle,
- base::SyncSocket::Handle socket_handle,
- uint32 length) OVERRIDE;
- virtual void OnVolume(double volume) OVERRIDE;
- virtual void OnStateChanged(AudioStreamState state) OVERRIDE;
- virtual void OnDeviceReady(const std::string&) OVERRIDE;
-
void OnDeviceOpened(int request_id,
bool succeeded,
const std::string& label);
diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.cc b/content/renderer/pepper/pepper_platform_audio_output_impl.cc
index 84ae082..65239e6 100644
--- a/content/renderer/pepper/pepper_platform_audio_output_impl.cc
+++ b/content/renderer/pepper/pepper_platform_audio_output_impl.cc
@@ -15,20 +15,6 @@
namespace content {
-PepperPlatformAudioOutputImpl::PepperPlatformAudioOutputImpl()
- : client_(NULL),
- stream_id_(0),
- main_message_loop_proxy_(base::MessageLoopProxy::current()) {
- filter_ = RenderThreadImpl::current()->audio_message_filter();
-}
-
-PepperPlatformAudioOutputImpl::~PepperPlatformAudioOutputImpl() {
- // Make sure we have been shut down. Warning: this will usually happen on
- // the I/O thread!
- DCHECK_EQ(0, stream_id_);
- DCHECK(!client_);
-}
-
// static
PepperPlatformAudioOutputImpl* PepperPlatformAudioOutputImpl::Create(
int sample_rate,
@@ -75,6 +61,47 @@ void PepperPlatformAudioOutputImpl::ShutDown() {
base::Bind(&PepperPlatformAudioOutputImpl::ShutDownOnIOThread, this));
}
+void PepperPlatformAudioOutputImpl::OnStateChanged(AudioStreamState state) {}
+
+void PepperPlatformAudioOutputImpl::OnStreamCreated(
+ base::SharedMemoryHandle handle,
+ base::SyncSocket::Handle socket_handle,
+ uint32 length) {
+#if defined(OS_WIN)
+ DCHECK(handle);
+ DCHECK(socket_handle);
+#else
+ DCHECK_NE(-1, handle.fd);
+ DCHECK_NE(-1, socket_handle);
+#endif
+ DCHECK(length);
+
+ if (base::MessageLoopProxy::current() == main_message_loop_proxy_) {
+ // Must dereference the client only on the main thread. Shutdown may have
+ // occurred while the request was in-flight, so we need to NULL check.
+ if (client_)
+ client_->StreamCreated(handle, length, socket_handle);
+ } else {
+ main_message_loop_proxy_->PostTask(FROM_HERE,
+ base::Bind(&PepperPlatformAudioOutputImpl::OnStreamCreated, this,
+ handle, socket_handle, length));
+ }
+}
+
+PepperPlatformAudioOutputImpl::~PepperPlatformAudioOutputImpl() {
+ // Make sure we have been shut down. Warning: this will usually happen on
+ // the I/O thread!
+ DCHECK_EQ(0, stream_id_);
+ DCHECK(!client_);
+}
+
+PepperPlatformAudioOutputImpl::PepperPlatformAudioOutputImpl()
+ : client_(NULL),
+ stream_id_(0),
+ main_message_loop_proxy_(base::MessageLoopProxy::current()) {
+ filter_ = RenderThreadImpl::current()->audio_message_filter();
+}
+
bool PepperPlatformAudioOutputImpl::Initialize(
int sample_rate,
int frames_per_buffer,
@@ -136,32 +163,4 @@ void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() {
// PepperPluginDelegateImpl::CreateAudio.
}
-void PepperPlatformAudioOutputImpl::OnStateChanged(AudioStreamState state) {
-}
-
-void PepperPlatformAudioOutputImpl::OnStreamCreated(
- base::SharedMemoryHandle handle,
- base::SyncSocket::Handle socket_handle,
- uint32 length) {
-#if defined(OS_WIN)
- DCHECK(handle);
- DCHECK(socket_handle);
-#else
- DCHECK_NE(-1, handle.fd);
- DCHECK_NE(-1, socket_handle);
-#endif
- DCHECK(length);
-
- if (base::MessageLoopProxy::current() == main_message_loop_proxy_) {
- // Must dereference the client only on the main thread. Shutdown may have
- // occurred while the request was in-flight, so we need to NULL check.
- if (client_)
- client_->StreamCreated(handle, length, socket_handle);
- } else {
- main_message_loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::OnStreamCreated, this,
- handle, socket_handle, length));
- }
-}
-
} // namespace content
diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.h b/content/renderer/pepper/pepper_platform_audio_output_impl.h
index 6ad8b80..3b426ad 100644
--- a/content/renderer/pepper/pepper_platform_audio_output_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_output_impl.h
@@ -25,8 +25,6 @@ class PepperPlatformAudioOutputImpl
public AudioMessageFilter::Delegate,
public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> {
public:
- virtual ~PepperPlatformAudioOutputImpl();
-
// Factory function, returns NULL on failure. StreamCreated() will be called
// when the stream is created.
static PepperPlatformAudioOutputImpl* Create(
@@ -39,7 +37,18 @@ class PepperPlatformAudioOutputImpl
virtual bool StopPlayback() OVERRIDE;
virtual void ShutDown() OVERRIDE;
+ // AudioMessageFilter::Delegate.
+ virtual void OnStateChanged(AudioStreamState state) OVERRIDE;
+ virtual void OnStreamCreated(base::SharedMemoryHandle handle,
+ base::SyncSocket::Handle socket_handle,
+ uint32 length) OVERRIDE;
+
+ protected:
+ virtual ~PepperPlatformAudioOutputImpl();
+
private:
+ friend class base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl>;
+
PepperPlatformAudioOutputImpl();
bool Initialize(
@@ -53,12 +62,6 @@ class PepperPlatformAudioOutputImpl
void StopPlaybackOnIOThread();
void ShutDownOnIOThread();
- // AudioMessageFilter::Delegate.
- virtual void OnStateChanged(AudioStreamState state) OVERRIDE;
- virtual void OnStreamCreated(base::SharedMemoryHandle handle,
- base::SyncSocket::Handle socket_handle,
- uint32 length) OVERRIDE;
-
// The client to notify when the stream is created. THIS MUST ONLY BE
// ACCESSED ON THE MAIN THREAD.
webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_;
diff --git a/content/renderer/pepper/pepper_platform_video_capture_impl.cc b/content/renderer/pepper/pepper_platform_video_capture_impl.cc
index c688d3d..35bfd58 100644
--- a/content/renderer/pepper/pepper_platform_video_capture_impl.cc
+++ b/content/renderer/pepper/pepper_platform_video_capture_impl.cc
@@ -42,17 +42,6 @@ PepperPlatformVideoCaptureImpl::PepperPlatformVideoCaptureImpl(
}
}
-PepperPlatformVideoCaptureImpl::~PepperPlatformVideoCaptureImpl() {
- if (video_capture_) {
- VideoCaptureImplManager* manager =
- RenderThreadImpl::current()->video_capture_impl_manager();
- manager->RemoveDevice(session_id_, handler_proxy_.get());
- }
-
- if (plugin_delegate_ && !label_.empty())
- plugin_delegate_->CloseDevice(label_);
-}
-
void PepperPlatformVideoCaptureImpl::StartCapture(
media::VideoCapture::EventHandler* handler,
const media::VideoCaptureCapability& capability) {
@@ -155,6 +144,17 @@ void PepperPlatformVideoCaptureImpl::OnDeviceInfoReceived(
handler_->OnDeviceInfoReceived(capture, device_info);
}
+PepperPlatformVideoCaptureImpl::~PepperPlatformVideoCaptureImpl() {
+ if (video_capture_) {
+ VideoCaptureImplManager* manager =
+ RenderThreadImpl::current()->video_capture_impl_manager();
+ manager->RemoveDevice(session_id_, handler_proxy_.get());
+ }
+
+ if (plugin_delegate_ && !label_.empty())
+ plugin_delegate_->CloseDevice(label_);
+}
+
void PepperPlatformVideoCaptureImpl::Initialize() {
VideoCaptureImplManager* manager =
RenderThreadImpl::current()->video_capture_impl_manager();
diff --git a/content/renderer/pepper/pepper_platform_video_capture_impl.h b/content/renderer/pepper/pepper_platform_video_capture_impl.h
index 02fe6ab..a4fe0df 100644
--- a/content/renderer/pepper/pepper_platform_video_capture_impl.h
+++ b/content/renderer/pepper/pepper_platform_video_capture_impl.h
@@ -32,7 +32,6 @@ class PepperPlatformVideoCaptureImpl
const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
const std::string& device_id,
webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler);
- virtual ~PepperPlatformVideoCaptureImpl();
// webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation.
virtual void StartCapture(
@@ -58,6 +57,9 @@ class PepperPlatformVideoCaptureImpl
VideoCapture* capture,
const media::VideoCaptureParams& device_info) OVERRIDE;
+ protected:
+ virtual ~PepperPlatformVideoCaptureImpl();
+
private:
void Initialize();
diff --git a/content/renderer/plugin_channel_host.cc b/content/renderer/plugin_channel_host.cc
index e055852..f9f384e 100644
--- a/content/renderer/plugin_channel_host.cc
+++ b/content/renderer/plugin_channel_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,6 +29,9 @@ class IsListeningFilter : public IPC::ChannelProxy::MessageFilter {
static bool is_listening_;
+ protected:
+ virtual ~IsListeningFilter() {}
+
private:
IPC::Channel* channel_;
diff --git a/content/renderer/render_widget_fullscreen.cc b/content/renderer/render_widget_fullscreen.cc
index 7916889..7030e5d 100644
--- a/content/renderer/render_widget_fullscreen.cc
+++ b/content/renderer/render_widget_fullscreen.cc
@@ -18,21 +18,6 @@ RenderWidgetFullscreen* RenderWidgetFullscreen::Create(int32 opener_id) {
return widget.release();
}
-WebWidget* RenderWidgetFullscreen::CreateWebWidget() {
- // TODO(boliu): Handle full screen render widgets here.
- return RenderWidget::CreateWebWidget(this);
-}
-
-void RenderWidgetFullscreen::Init(int32 opener_id) {
- DCHECK(!webwidget_);
-
- RenderWidget::DoInit(
- opener_id,
- CreateWebWidget(),
- new ViewHostMsg_CreateFullscreenWidget(
- opener_id, &routing_id_, &surface_id_));
-}
-
void RenderWidgetFullscreen::show(WebKit::WebNavigationPolicy) {
DCHECK(!did_show_) << "received extraneous Show call";
DCHECK_NE(MSG_ROUTING_NONE, routing_id_);
@@ -48,3 +33,20 @@ void RenderWidgetFullscreen::show(WebKit::WebNavigationPolicy) {
RenderWidgetFullscreen::RenderWidgetFullscreen()
: RenderWidget(WebKit::WebPopupTypeNone, WebKit::WebScreenInfo()) {
}
+
+RenderWidgetFullscreen::~RenderWidgetFullscreen() {}
+
+WebWidget* RenderWidgetFullscreen::CreateWebWidget() {
+ // TODO(boliu): Handle full screen render widgets here.
+ return RenderWidget::CreateWebWidget(this);
+}
+
+void RenderWidgetFullscreen::Init(int32 opener_id) {
+ DCHECK(!webwidget_);
+
+ RenderWidget::DoInit(
+ opener_id,
+ CreateWebWidget(),
+ new ViewHostMsg_CreateFullscreenWidget(
+ opener_id, &routing_id_, &surface_id_));
+}
diff --git a/content/renderer/render_widget_fullscreen.h b/content/renderer/render_widget_fullscreen.h
index bfb04f7..99c6e56 100644
--- a/content/renderer/render_widget_fullscreen.h
+++ b/content/renderer/render_widget_fullscreen.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,8 +19,10 @@ class RenderWidgetFullscreen : public RenderWidget {
virtual void show(WebKit::WebNavigationPolicy);
protected:
- virtual WebKit::WebWidget* CreateWebWidget();
RenderWidgetFullscreen();
+ virtual ~RenderWidgetFullscreen();
+
+ virtual WebKit::WebWidget* CreateWebWidget();
void Init(int32 opener_id);
};
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index ae7a8a4..07d5313 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -74,7 +74,9 @@ void InstallFrameworkHacks() {
#if defined(OS_POSIX)
class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
- void OnChannelError() {
+ public:
+ // IPC::ChannelProxy::MessageFilter
+ virtual void OnChannelError() OVERRIDE {
// On POSIX, at least, one can install an unload handler which loops
// forever and leave behind a renderer process which eats 100% CPU forever.
//
@@ -101,6 +103,9 @@ class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
#endif
_exit(0);
}
+
+ protected:
+ virtual ~SuicideOnChannelErrorFilter() {}
};
#endif // OS(POSIX)