summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 02:15:14 +0000
committerjiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 02:15:14 +0000
commitbc2b5339e29ef57755a24541618b482791a79741 (patch)
tree205ea5d1357127761a2482f4b8d0a3519d9db812 /chrome/renderer
parent90809de024ac572e6db7265984ea9e13aa2d4075 (diff)
downloadchromium_src-bc2b5339e29ef57755a24541618b482791a79741.zip
chromium_src-bc2b5339e29ef57755a24541618b482791a79741.tar.gz
chromium_src-bc2b5339e29ef57755a24541618b482791a79741.tar.bz2
gpu: GpuVideo*Host stop hold ref pointer to GpuChannelHost.
Singleton is destructed at exit(), we are kind of late to release the last ref count for GpuChannelHost. use raw pointer for now. long term plan is to either forward close() to GpuVideo* or We move our singleton to destruct at ~RenderThread() where message loop is still alive? BUG=53896 TEST=None. Review URL: http://codereview.chromium.org/3232008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/gpu_video_decoder_host.cc16
-rw-r--r--chrome/renderer/gpu_video_decoder_host.h2
-rw-r--r--chrome/renderer/gpu_video_service_host.cc9
-rw-r--r--chrome/renderer/gpu_video_service_host.h2
4 files changed, 16 insertions, 13 deletions
diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc
index 16b818a..a1a7962 100644
--- a/chrome/renderer/gpu_video_decoder_host.cc
+++ b/chrome/renderer/gpu_video_decoder_host.cc
@@ -24,7 +24,7 @@ GpuVideoDecoderHost::GpuVideoDecoderHost(GpuVideoServiceHost* service_host,
}
void GpuVideoDecoderHost::OnChannelError() {
- channel_host_.release();
+ channel_host_ = NULL;
}
void GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) {
@@ -49,7 +49,7 @@ bool GpuVideoDecoderHost::Initialize(const GpuVideoDecoderInitParam& param) {
DCHECK_EQ(state_, kStateUninitialized);
init_param_ = param;
- if (!channel_host_->Send(
+ if (!channel_host_ || !channel_host_->Send(
new GpuVideoDecoderMsg_Initialize(route_id(), param))) {
LOG(ERROR) << "GpuVideoDecoderMsg_Initialize failed";
return false;
@@ -58,7 +58,8 @@ bool GpuVideoDecoderHost::Initialize(const GpuVideoDecoderInitParam& param) {
}
bool GpuVideoDecoderHost::Uninitialize() {
- if (!channel_host_->Send(new GpuVideoDecoderMsg_Destroy(route_id()))) {
+ if (!channel_host_ || !channel_host_->Send(
+ new GpuVideoDecoderMsg_Destroy(route_id()))) {
LOG(ERROR) << "GpuVideoDecoderMsg_Destroy failed";
return false;
}
@@ -87,7 +88,7 @@ void GpuVideoDecoderHost::FillThisBuffer(scoped_refptr<VideoFrame> frame) {
return;
GpuVideoDecoderOutputBufferParam param;
- if (!channel_host_->Send(
+ if (!channel_host_ || !channel_host_->Send(
new GpuVideoDecoderMsg_FillThisBuffer(route_id(), param))) {
LOG(ERROR) << "GpuVideoDecoderMsg_FillThisBuffer failed";
}
@@ -95,7 +96,8 @@ void GpuVideoDecoderHost::FillThisBuffer(scoped_refptr<VideoFrame> frame) {
bool GpuVideoDecoderHost::Flush() {
state_ = kStateFlushing;
- if (!channel_host_->Send(new GpuVideoDecoderMsg_Flush(route_id()))) {
+ if (!channel_host_ || !channel_host_->Send(
+ new GpuVideoDecoderMsg_Flush(route_id()))) {
LOG(ERROR) << "GpuVideoDecoderMsg_Flush failed";
return false;
}
@@ -179,7 +181,7 @@ void GpuVideoDecoderHost::OnFillThisBufferDone(
}
event_handler_->OnFillBufferDone(frame);
- if (!channel_host_->Send(
+ if (!channel_host_ || !channel_host_->Send(
new GpuVideoDecoderMsg_FillThisBufferDoneACK(route_id()))) {
LOG(ERROR) << "GpuVideoDecoderMsg_FillThisBufferDoneACK failed";
}
@@ -206,7 +208,7 @@ void GpuVideoDecoderHost::SendInputBufferToGpu() {
param.size_ = buffer->GetDataSize();
param.timestamp_ = buffer->GetTimestamp().InMicroseconds();
memcpy(input_transfer_buffer_->memory(), buffer->GetData(), param.size_);
- if (!channel_host_->Send(
+ if (!channel_host_ || !channel_host_->Send(
new GpuVideoDecoderMsg_EmptyThisBuffer(route_id(), param))) {
LOG(ERROR) << "GpuVideoDecoderMsg_EmptyThisBuffer failed";
}
diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h
index dccafff..af88561 100644
--- a/chrome/renderer/gpu_video_decoder_host.h
+++ b/chrome/renderer/gpu_video_decoder_host.h
@@ -81,7 +81,7 @@ class GpuVideoDecoderHost
// We expect that GpuVideoServiceHost's always available during our life span.
GpuVideoServiceHost* gpu_video_service_host_;
- scoped_refptr<GpuChannelHost> channel_host_;
+ GpuChannelHost* channel_host_;
// We expect that the client of us will always available during our life span.
EventHandler* event_handler_;
diff --git a/chrome/renderer/gpu_video_service_host.cc b/chrome/renderer/gpu_video_service_host.cc
index 61a2dcd..c80e35d 100644
--- a/chrome/renderer/gpu_video_service_host.cc
+++ b/chrome/renderer/gpu_video_service_host.cc
@@ -9,14 +9,15 @@
#include "chrome/renderer/render_thread.h"
GpuVideoServiceHost::GpuVideoServiceHost()
- : router_(NULL),
+ : channel_host_(NULL),
+ router_(NULL),
message_loop_(NULL) {
memset(&service_info_, 0, sizeof(service_info_));
}
void GpuVideoServiceHost::OnChannelError() {
LOG(ERROR) << "GpuVideoServiceHost::OnChannelError";
- channel_host_.release();
+ channel_host_ = NULL;
router_ = NULL;
}
@@ -32,7 +33,7 @@ scoped_refptr<GpuVideoDecoderHost> GpuVideoServiceHost::CreateVideoDecoder(
GpuVideoDecoderHost::EventHandler* event_handler) {
DCHECK(RenderThread::current());
- if (!channel_host_.get() || !service_info_.service_available_)
+ if (!channel_host_ || !service_info_.service_available_)
return NULL;
GpuVideoDecoderInfoParam param;
@@ -60,7 +61,7 @@ void GpuVideoServiceHost::DestroyVideoDecoder(
scoped_refptr<GpuVideoDecoderHost> gpu_video_decoder_host) {
DCHECK(RenderThread::current());
- if (!channel_host_.get() || !service_info_.service_available_)
+ if (!channel_host_ || !service_info_.service_available_)
return;
DCHECK(gpu_video_decoder_host.get());
diff --git a/chrome/renderer/gpu_video_service_host.h b/chrome/renderer/gpu_video_service_host.h
index 1d458e9..d3ca06f 100644
--- a/chrome/renderer/gpu_video_service_host.h
+++ b/chrome/renderer/gpu_video_service_host.h
@@ -34,7 +34,7 @@ class GpuVideoServiceHost : public IPC::Channel::Listener,
private:
GpuVideoServiceHost();
- scoped_refptr<GpuChannelHost> channel_host_;
+ GpuChannelHost* channel_host_;
MessageRouter* router_;
GpuVideoServiceInfoParam service_info_;
MessageLoop* message_loop_; // Message loop of render thread.