| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ret.m_end = std::max(m_end, range.m_end); | 77 ret.m_end = std::max(m_end, range.m_end); |
| 78 | 78 |
| 79 return ret; | 79 return ret; |
| 80 } | 80 } |
| 81 | 81 |
| 82 inline bool isBeforeRange(const Range& range) const | 82 inline bool isBeforeRange(const Range& range) const |
| 83 { | 83 { |
| 84 return range.m_start >= m_end; | 84 return range.m_start >= m_end; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void trace(Visitor*) { } | 87 DEFINE_INLINE_TRACE() { } |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 static PassRefPtrWillBeRawPtr<TimeRanges> create() | 90 static PassRefPtrWillBeRawPtr<TimeRanges> create() |
| 91 { | 91 { |
| 92 return adoptRefWillBeNoop(new TimeRanges); | 92 return adoptRefWillBeNoop(new TimeRanges); |
| 93 } | 93 } |
| 94 static PassRefPtrWillBeRawPtr<TimeRanges> create(double start, double end) | 94 static PassRefPtrWillBeRawPtr<TimeRanges> create(double start, double end) |
| 95 { | 95 { |
| 96 return adoptRefWillBeNoop(new TimeRanges(start, end)); | 96 return adoptRefWillBeNoop(new TimeRanges(start, end)); |
| 97 } | 97 } |
| 98 static PassRefPtrWillBeRawPtr<TimeRanges> create(const blink::WebTimeRanges&
); | 98 static PassRefPtrWillBeRawPtr<TimeRanges> create(const blink::WebTimeRanges&
); |
| 99 | 99 |
| 100 PassRefPtrWillBeRawPtr<TimeRanges> copy() const; | 100 PassRefPtrWillBeRawPtr<TimeRanges> copy() const; |
| 101 void intersectWith(const TimeRanges*); | 101 void intersectWith(const TimeRanges*); |
| 102 void unionWith(const TimeRanges*); | 102 void unionWith(const TimeRanges*); |
| 103 | 103 |
| 104 unsigned length() const { return m_ranges.size(); } | 104 unsigned length() const { return m_ranges.size(); } |
| 105 double start(unsigned index, ExceptionState&) const; | 105 double start(unsigned index, ExceptionState&) const; |
| 106 double end(unsigned index, ExceptionState&) const; | 106 double end(unsigned index, ExceptionState&) const; |
| 107 | 107 |
| 108 void add(double start, double end); | 108 void add(double start, double end); |
| 109 | 109 |
| 110 bool contain(double time) const; | 110 bool contain(double time) const; |
| 111 | 111 |
| 112 double nearest(double newPlaybackPosition, double currentPlaybackPosition) c
onst; | 112 double nearest(double newPlaybackPosition, double currentPlaybackPosition) c
onst; |
| 113 | 113 |
| 114 void trace(Visitor*); | 114 DECLARE_TRACE(); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 TimeRanges() { } | 117 TimeRanges() { } |
| 118 | 118 |
| 119 TimeRanges(double start, double end); | 119 TimeRanges(double start, double end); |
| 120 | 120 |
| 121 void invert(); | 121 void invert(); |
| 122 | 122 |
| 123 WillBeHeapVector<Range> m_ranges; | 123 WillBeHeapVector<Range> m_ranges; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace blink | 126 } // namespace blink |
| 127 | 127 |
| 128 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::TimeRanges::Range); | 128 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::TimeRanges::Range); |
| 129 | 129 |
| 130 #endif // TimeRanges_h | 130 #endif // TimeRanges_h |
| OLD | NEW |