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

Side by Side Diff: media/base/filters.h

Issue 9717021: Make Callback::Reset() return a copy to support use-cases where Run() ends up modifying |*this|. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 // Filters are connected in a strongly typed manner, with downstream filters 5 // Filters are connected in a strongly typed manner, with downstream filters
6 // always reading data from upstream filters. Upstream filters have no clue 6 // always reading data from upstream filters. Upstream filters have no clue
7 // who is actually reading from them, and return the results via callbacks. 7 // who is actually reading from them, and return the results via callbacks.
8 // 8 //
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer
10 // DataSource <- Demuxer < 10 // DataSource <- Demuxer <
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class Decoder; 43 class Decoder;
44 class DemuxerStream; 44 class DemuxerStream;
45 class Filter; 45 class Filter;
46 class FilterHost; 46 class FilterHost;
47 47
48 struct PipelineStatistics; 48 struct PipelineStatistics;
49 49
50 // Used for completing asynchronous methods. 50 // Used for completing asynchronous methods.
51 typedef base::Callback<void(PipelineStatus)> FilterStatusCB; 51 typedef base::Callback<void(PipelineStatus)> FilterStatusCB;
52 52
53 // These functions copy |*cb|, call Reset() on |*cb|, and then call Run()
54 // on the copy. This is used in the common case where you need to clear
55 // a callback member variable before running the callback.
56 MEDIA_EXPORT void ResetAndRunCB(FilterStatusCB* cb, PipelineStatus status);
57 MEDIA_EXPORT void ResetAndRunCB(base::Closure* cb);
58
59 class MEDIA_EXPORT Filter : public base::RefCountedThreadSafe<Filter> { 53 class MEDIA_EXPORT Filter : public base::RefCountedThreadSafe<Filter> {
60 public: 54 public:
61 Filter(); 55 Filter();
62 56
63 // Sets the private member |host_|. This is the first method called by 57 // Sets the private member |host_|. This is the first method called by
64 // the FilterHost after a filter is created. The host holds a strong 58 // the FilterHost after a filter is created. The host holds a strong
65 // reference to the filter. The reference held by the host is guaranteed 59 // reference to the filter. The reference held by the host is guaranteed
66 // to be released before the host object is destroyed by the pipeline. 60 // to be released before the host object is destroyed by the pipeline.
67 virtual void set_host(FilterHost* host); 61 virtual void set_host(FilterHost* host);
68 62
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 207
214 // Resumes playback after underflow occurs. 208 // Resumes playback after underflow occurs.
215 // |buffer_more_audio| is set to true if you want to increase the size of the 209 // |buffer_more_audio| is set to true if you want to increase the size of the
216 // decoded audio buffer. 210 // decoded audio buffer.
217 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; 211 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
218 }; 212 };
219 213
220 } // namespace media 214 } // namespace media
221 215
222 #endif // MEDIA_BASE_FILTERS_H_ 216 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698