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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), 53 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr),
54 natural_size(ns) { 54 natural_size(ns) {
55 } 55 }
56 56
57 GpuVideoDecoder::BufferData::~BufferData() {} 57 GpuVideoDecoder::BufferData::~BufferData() {}
58 58
59 GpuVideoDecoder::GpuVideoDecoder( 59 GpuVideoDecoder::GpuVideoDecoder(
60 const scoped_refptr<GpuVideoAcceleratorFactories>& factories, 60 const scoped_refptr<GpuVideoAcceleratorFactories>& factories,
61 const scoped_refptr<MediaLog>& media_log) 61 const scoped_refptr<MediaLog>& media_log)
62 : needs_bitstream_conversion_(false), 62 : needs_bitstream_conversion_(false),
63 weak_factory_(this),
64 factories_(factories), 63 factories_(factories),
65 state_(kNormal), 64 state_(kNormal),
66 media_log_(media_log), 65 media_log_(media_log),
67 decoder_texture_target_(0), 66 decoder_texture_target_(0),
68 next_picture_buffer_id_(0), 67 next_picture_buffer_id_(0),
69 next_bitstream_buffer_id_(0), 68 next_bitstream_buffer_id_(0),
70 available_pictures_(0) { 69 available_pictures_(0),
70 weak_factory_(this) {
71 DCHECK(factories_.get()); 71 DCHECK(factories_.get());
72 } 72 }
73 73
74 void GpuVideoDecoder::Reset(const base::Closure& closure) { 74 void GpuVideoDecoder::Reset(const base::Closure& closure) {
75 DVLOG(3) << "Reset()"; 75 DVLOG(3) << "Reset()";
76 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 76 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
77 77
78 if (state_ == kDrainingDecoder) { 78 if (state_ == kDrainingDecoder) {
79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
80 &GpuVideoDecoder::Reset, weak_this_, closure)); 80 &GpuVideoDecoder::Reset, weak_this_, closure));
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return; 645 return;
646 } 646 }
647 } 647 }
648 648
649 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 649 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
650 const { 650 const {
651 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 651 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
652 } 652 }
653 653
654 } // namespace media 654 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698