Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Side by Side Diff: content/renderer/gpu/gpu_video_decode_accelerator_host.cc

Issue 7629022: Handle client going away after GVDAH::Destroy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" 5 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 void GpuVideoDecodeAcceleratorHost::Reset() { 105 void GpuVideoDecodeAcceleratorHost::Reset() {
106 DCHECK(CalledOnValidThread()); 106 DCHECK(CalledOnValidThread());
107 Send(new AcceleratedVideoDecoderMsg_Reset(command_buffer_route_id_)); 107 Send(new AcceleratedVideoDecoderMsg_Reset(command_buffer_route_id_));
108 } 108 }
109 109
110 void GpuVideoDecodeAcceleratorHost::Destroy() { 110 void GpuVideoDecodeAcceleratorHost::Destroy() {
111 DCHECK(CalledOnValidThread()); 111 DCHECK(CalledOnValidThread());
112 Send(new AcceleratedVideoDecoderMsg_Destroy(command_buffer_route_id_)); 112 Send(new AcceleratedVideoDecoderMsg_Destroy(command_buffer_route_id_));
113 client_ = NULL;
113 } 114 }
114 115
115 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { 116 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) {
116 // After OnChannelError is called, the client should no longer send 117 // After OnChannelError is called, the client should no longer send
117 // messages to the gpu channel through this object. 118 // messages to the gpu channel through this object.
118 DCHECK(ipc_sender_); 119 DCHECK(ipc_sender_);
119 if (!ipc_sender_ || !ipc_sender_->Send(message)) { 120 if (!ipc_sender_ || !ipc_sender_->Send(message)) {
120 DLOG(ERROR) << "Send(" << message->type() << ") failed"; 121 DLOG(ERROR) << "Send(" << message->type() << ") failed";
121 OnErrorNotification(PLATFORM_FAILURE); 122 OnErrorNotification(PLATFORM_FAILURE);
122 } 123 }
123 } 124 }
124 125
125 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( 126 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed(
126 int32 bitstream_buffer_id) { 127 int32 bitstream_buffer_id) {
127 DCHECK(CalledOnValidThread()); 128 DCHECK(CalledOnValidThread());
128 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); 129 if (client_)
130 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id);
129 } 131 }
130 132
131 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( 133 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer(
132 uint32 num_requested_buffers, 134 uint32 num_requested_buffers,
133 const gfx::Size& buffer_size) { 135 const gfx::Size& buffer_size) {
134 DCHECK(CalledOnValidThread()); 136 DCHECK(CalledOnValidThread());
135 client_->ProvidePictureBuffers(num_requested_buffers, buffer_size); 137 if (client_)
138 client_->ProvidePictureBuffers(num_requested_buffers, buffer_size);
136 } 139 }
137 140
138 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( 141 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer(
139 int32 picture_buffer_id) { 142 int32 picture_buffer_id) {
140 DCHECK(CalledOnValidThread()); 143 DCHECK(CalledOnValidThread());
141 client_->DismissPictureBuffer(picture_buffer_id); 144 if (client_)
145 client_->DismissPictureBuffer(picture_buffer_id);
142 } 146 }
143 147
144 void GpuVideoDecodeAcceleratorHost::OnPictureReady( 148 void GpuVideoDecodeAcceleratorHost::OnPictureReady(
145 int32 picture_buffer_id, int32 bitstream_buffer_id) { 149 int32 picture_buffer_id, int32 bitstream_buffer_id) {
146 DCHECK(CalledOnValidThread()); 150 DCHECK(CalledOnValidThread());
151 if (!client_)
152 return;
147 media::Picture picture(picture_buffer_id, bitstream_buffer_id); 153 media::Picture picture(picture_buffer_id, bitstream_buffer_id);
148 client_->PictureReady(picture); 154 client_->PictureReady(picture);
149 } 155 }
150 156
151 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { 157 void GpuVideoDecodeAcceleratorHost::OnFlushDone() {
152 DCHECK(CalledOnValidThread()); 158 DCHECK(CalledOnValidThread());
153 client_->NotifyFlushDone(); 159 if (client_)
160 client_->NotifyFlushDone();
154 } 161 }
155 162
156 void GpuVideoDecodeAcceleratorHost::OnResetDone() { 163 void GpuVideoDecodeAcceleratorHost::OnResetDone() {
157 DCHECK(CalledOnValidThread()); 164 DCHECK(CalledOnValidThread());
158 client_->NotifyResetDone(); 165 if (client_)
166 client_->NotifyResetDone();
159 } 167 }
160 168
161 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { 169 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() {
162 DCHECK(CalledOnValidThread()); 170 DCHECK(CalledOnValidThread());
163 client_->NotifyEndOfStream(); 171 if (client_)
172 client_->NotifyEndOfStream();
164 } 173 }
165 174
166 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { 175 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) {
167 DCHECK(CalledOnValidThread()); 176 DCHECK(CalledOnValidThread());
177 if (!client_)
178 return;
168 client_->NotifyError( 179 client_->NotifyError(
169 static_cast<media::VideoDecodeAccelerator::Error>(error)); 180 static_cast<media::VideoDecodeAccelerator::Error>(error));
170 } 181 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698