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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 , m_state(Initial) | 84 , m_state(Initial) |
85 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) | 85 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) |
86 , m_currentStartTime(0) | 86 , m_currentStartTime(0) |
87 , m_currentEndTime(0) | 87 , m_currentEndTime(0) |
88 , m_client(client) | 88 , m_client(client) |
89 { | 89 { |
90 } | 90 } |
91 | 91 |
92 void VTTParser::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) | 92 void VTTParser::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) |
93 { | 93 { |
94 ASSERT(outputCues.isEmpty()); | 94 DCHECK(outputCues.isEmpty()); |
95 outputCues.swap(m_cueList); | 95 outputCues.swap(m_cueList); |
96 } | 96 } |
97 | 97 |
98 void VTTParser::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions) | 98 void VTTParser::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions) |
99 { | 99 { |
100 ASSERT(outputRegions.isEmpty()); | 100 DCHECK(outputRegions.isEmpty()); |
101 outputRegions.swap(m_regionList); | 101 outputRegions.swap(m_regionList); |
102 } | 102 } |
103 | 103 |
104 void VTTParser::parseBytes(const char* data, size_t length) | 104 void VTTParser::parseBytes(const char* data, size_t length) |
105 { | 105 { |
106 String textData = m_decoder->decode(data, length); | 106 String textData = m_decoder->decode(data, length); |
107 m_lineReader.append(textData); | 107 m_lineReader.append(textData); |
108 parse(); | 108 parse(); |
109 } | 109 } |
110 | 110 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 case BadCue: | 186 case BadCue: |
187 // Steps 42 - 48 - Discard lines until an empty line or a potential
timing line is seen. | 187 // Steps 42 - 48 - Discard lines until an empty line or a potential
timing line is seen. |
188 m_state = ignoreBadCue(line); | 188 m_state = ignoreBadCue(line); |
189 break; | 189 break; |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 void VTTParser::flushPendingCue() | 194 void VTTParser::flushPendingCue() |
195 { | 195 { |
196 ASSERT(m_lineReader.isAtEndOfStream()); | 196 DCHECK(m_lineReader.isAtEndOfStream()); |
197 // If we're in the CueText state when we run out of data, we emit the pendin
g cue. | 197 // If we're in the CueText state when we run out of data, we emit the pendin
g cue. |
198 if (m_state == CueText) | 198 if (m_state == CueText) |
199 createNewCue(); | 199 createNewCue(); |
200 } | 200 } |
201 | 201 |
202 bool VTTParser::hasRequiredFileIdentifier(const String& line) | 202 bool VTTParser::hasRequiredFileIdentifier(const String& line) |
203 { | 203 { |
204 // A WebVTT file identifier consists of an optional BOM character, | 204 // A WebVTT file identifier consists of an optional BOM character, |
205 // the string "WEBVTT" followed by an optional space or tab character, | 205 // the string "WEBVTT" followed by an optional space or tab character, |
206 // and any number of characters that are not line terminators ... | 206 // and any number of characters that are not line terminators ... |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 560 |
561 DEFINE_TRACE(VTTParser) | 561 DEFINE_TRACE(VTTParser) |
562 { | 562 { |
563 visitor->trace(m_document); | 563 visitor->trace(m_document); |
564 visitor->trace(m_client); | 564 visitor->trace(m_client); |
565 visitor->trace(m_cueList); | 565 visitor->trace(m_cueList); |
566 visitor->trace(m_regionList); | 566 visitor->trace(m_regionList); |
567 } | 567 } |
568 | 568 |
569 } // namespace blink | 569 } // namespace blink |
OLD | NEW |