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

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

Issue 3859003: FBTF: Even more ctor/virtual deinlining. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef MEDIA_BASE_PTS_HEAP_H_ 5 #ifndef MEDIA_BASE_PTS_HEAP_H_
6 #define MEDIA_BASE_PTS_HEAP_H_ 6 #define MEDIA_BASE_PTS_HEAP_H_
7 7
8 // The compressed frame are often in decode timestamp (dts) order, which 8 // The compressed frame are often in decode timestamp (dts) order, which
9 // may not always be in presentation timestamp (pts) order. However, the 9 // may not always be in presentation timestamp (pts) order. However, the
10 // decoded frames will always be returned in pts order. Ideally, the pts could 10 // decoded frames will always be returned in pts order. Ideally, the pts could
(...skipping 18 matching lines...) Expand all
29 29
30 #include <queue> 30 #include <queue>
31 #include <vector> 31 #include <vector>
32 32
33 #include "base/time.h" 33 #include "base/time.h"
34 34
35 namespace media { 35 namespace media {
36 36
37 class PtsHeap { 37 class PtsHeap {
38 public: 38 public:
39 PtsHeap() {} 39 PtsHeap();
40 ~PtsHeap();
40 41
41 void Push(const base::TimeDelta& pts) { queue_.push(pts); } 42 void Push(const base::TimeDelta& pts);
42 void Pop() { queue_.pop(); } 43 void Pop();
43 44
44 const base::TimeDelta& Top() const { return queue_.top(); } 45 const base::TimeDelta& Top() const { return queue_.top(); }
45 bool IsEmpty() const { return queue_.empty(); } 46 bool IsEmpty() const { return queue_.empty(); }
46 47
47 private: 48 private:
48 struct PtsHeapOrdering { 49 struct PtsHeapOrdering {
49 bool operator()(const base::TimeDelta& lhs, 50 bool operator()(const base::TimeDelta& lhs,
50 const base::TimeDelta& rhs) const { 51 const base::TimeDelta& rhs) const {
51 // std::priority_queue is a max-heap. We want lower timestamps to show up 52 // std::priority_queue is a max-heap. We want lower timestamps to show up
52 // first so reverse the natural less-than comparison. 53 // first so reverse the natural less-than comparison.
53 return rhs < lhs; 54 return rhs < lhs;
54 } 55 }
55 }; 56 };
56 typedef std::priority_queue<base::TimeDelta, 57 typedef std::priority_queue<base::TimeDelta,
57 std::vector<base::TimeDelta>, 58 std::vector<base::TimeDelta>,
58 PtsHeapOrdering> TimeQueue; 59 PtsHeapOrdering> TimeQueue;
59 60
60 TimeQueue queue_; 61 TimeQueue queue_;
61 62
62 DISALLOW_COPY_AND_ASSIGN(PtsHeap); 63 DISALLOW_COPY_AND_ASSIGN(PtsHeap);
63 }; 64 };
64 65
65 } // namespace media 66 } // namespace media
66 67
67 #endif // MEDIA_BASE_PTS_HEAP_H_ 68 #endif // MEDIA_BASE_PTS_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698