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

Side by Side Diff: media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc

Issue 2023343002: Migrate WaitableEvent to enum-based constructor in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h" 5 #include "media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 GpuJpegDecodeAcceleratorHost::~GpuJpegDecodeAcceleratorHost() { 110 GpuJpegDecodeAcceleratorHost::~GpuJpegDecodeAcceleratorHost() {
111 DCHECK(CalledOnValidThread()); 111 DCHECK(CalledOnValidThread());
112 Send(new AcceleratedJpegDecoderMsg_Destroy(decoder_route_id_)); 112 Send(new AcceleratedJpegDecoderMsg_Destroy(decoder_route_id_));
113 113
114 if (receiver_) { 114 if (receiver_) {
115 channel_->RemoveRoute(decoder_route_id_); 115 channel_->RemoveRoute(decoder_route_id_);
116 116
117 // Invalidate weak ptr of |receiver_|. After that, no more messages will be 117 // Invalidate weak ptr of |receiver_|. After that, no more messages will be
118 // routed to |receiver_| on IO thread. 118 // routed to |receiver_| on IO thread.
119 base::WaitableEvent event(false, false); 119 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
120 base::WaitableEvent::InitialState::NOT_SIGNALED);
120 io_task_runner_->PostTask(FROM_HERE, 121 io_task_runner_->PostTask(FROM_HERE,
121 base::Bind(&Receiver::InvalidateWeakPtr, 122 base::Bind(&Receiver::InvalidateWeakPtr,
122 base::Unretained(receiver_.get()), 123 base::Unretained(receiver_.get()),
123 base::Unretained(&event))); 124 base::Unretained(&event)));
124 event.Wait(); 125 event.Wait();
125 } 126 }
126 } 127 }
127 128
128 bool GpuJpegDecodeAcceleratorHost::Initialize( 129 bool GpuJpegDecodeAcceleratorHost::Initialize(
129 JpegDecodeAccelerator::Client* client) { 130 JpegDecodeAccelerator::Client* client) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (!channel_->Send(message)) { 196 if (!channel_->Send(message)) {
196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; 197 DLOG(ERROR) << "Send(" << message->type() << ") failed";
197 } 198 }
198 } 199 }
199 200
200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { 201 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() {
201 return receiver_->AsWeakPtrForIO(); 202 return receiver_->AsWeakPtrForIO();
202 } 203 }
203 204
204 } // namespace media 205 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/vpx_video_decoder.cc ('k') | media/gpu/ipc/service/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698