OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 return 0; | 60 return 0; |
61 } | 61 } |
62 | 62 |
63 TextTrackCueList* TextTrackCueList::activeCues() | 63 TextTrackCueList* TextTrackCueList::activeCues() |
64 { | 64 { |
65 if (!m_activeCues) | 65 if (!m_activeCues) |
66 m_activeCues = create(); | 66 m_activeCues = create(); |
67 | 67 |
68 m_activeCues->clear(); | 68 m_activeCues->clear(); |
69 for (size_t i = 0; i < m_list.size(); ++i) { | 69 for (size_t i = 0; i < m_list.size(); ++i) { |
70 RefPtr<TextTrackCue> cue = m_list[i]; | 70 RefPtrWillBeRawPtr<TextTrackCue> cue = m_list[i]; |
71 if (cue->isActive()) | 71 if (cue->isActive()) |
72 m_activeCues->add(cue); | 72 m_activeCues->add(cue); |
73 } | 73 } |
74 return m_activeCues.get(); | 74 return m_activeCues.get(); |
75 } | 75 } |
76 | 76 |
77 bool TextTrackCueList::add(PassRefPtr<TextTrackCue> cue) | 77 bool TextTrackCueList::add(PassRefPtrWillBeRawPtr<TextTrackCue> cue) |
78 { | 78 { |
79 ASSERT(cue->startTime() >= 0); | 79 ASSERT(cue->startTime() >= 0); |
80 ASSERT(cue->endTime() >= 0); | 80 ASSERT(cue->endTime() >= 0); |
81 | 81 |
82 return add(cue, 0, m_list.size()); | 82 return add(cue, 0, m_list.size()); |
83 } | 83 } |
84 | 84 |
85 bool TextTrackCueList::add(PassRefPtr<TextTrackCue> prpCue, size_t start, size_t
end) | 85 bool TextTrackCueList::add(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue, size_t s
tart, size_t end) |
86 { | 86 { |
87 ASSERT_WITH_SECURITY_IMPLICATION(start <= m_list.size()); | 87 ASSERT_WITH_SECURITY_IMPLICATION(start <= m_list.size()); |
88 ASSERT_WITH_SECURITY_IMPLICATION(end <= m_list.size()); | 88 ASSERT_WITH_SECURITY_IMPLICATION(end <= m_list.size()); |
89 | 89 |
90 // Maintain text track cue order: | 90 // Maintain text track cue order: |
91 // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-order | 91 // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-order |
92 RefPtr<TextTrackCue> cue = prpCue; | 92 RefPtrWillBeRawPtr<TextTrackCue> cue = prpCue; |
93 if (start == end) { | 93 if (start == end) { |
94 if (!m_list.isEmpty() && (start > 0) && (m_list[start - 1].get() == cue.
get())) | 94 if (!m_list.isEmpty() && (start > 0) && (m_list[start - 1].get() == cue.
get())) |
95 return false; | 95 return false; |
96 | 96 |
97 m_list.insert(start, cue); | 97 m_list.insert(start, cue); |
98 invalidateCueIndexes(start); | 98 invalidateCueIndexes(start); |
99 return true; | 99 return true; |
100 } | 100 } |
101 | 101 |
102 size_t index = (start + end) / 2; | 102 size_t index = (start + end) / 2; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 { | 135 { |
136 m_list.clear(); | 136 m_list.clear(); |
137 } | 137 } |
138 | 138 |
139 void TextTrackCueList::invalidateCueIndexes(size_t start) | 139 void TextTrackCueList::invalidateCueIndexes(size_t start) |
140 { | 140 { |
141 for (size_t i = start; i < m_list.size(); ++i) | 141 for (size_t i = start; i < m_list.size(); ++i) |
142 m_list[i]->invalidateCueIndex(); | 142 m_list[i]->invalidateCueIndex(); |
143 } | 143 } |
144 | 144 |
| 145 void TextTrackCueList::trace(Visitor* visitor) |
| 146 { |
| 147 visitor->trace(m_list); |
| 148 visitor->trace(m_activeCues); |
| 149 } |
| 150 |
145 } // namespace WebCore | 151 } // namespace WebCore |
146 | 152 |
OLD | NEW |