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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 VTTParser::VTTParser(VTTParserClient* client, Document& document) | 83 VTTParser::VTTParser(VTTParserClient* client, Document& document) |
84 : m_document(&document) | 84 : m_document(&document) |
85 , m_state(Initial) | 85 , m_state(Initial) |
86 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) | 86 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) |
87 , m_currentStartTime(0) | 87 , m_currentStartTime(0) |
88 , m_currentEndTime(0) | 88 , m_currentEndTime(0) |
89 , m_client(client) | 89 , m_client(client) |
90 { | 90 { |
91 } | 91 } |
92 | 92 |
93 void VTTParser::getNewCues(WillBeHeapVector<RefPtrWillBeMember<VTTCue>>& outputC
ues) | 93 void VTTParser::getNewCues(WillBeHeapVector<RefPtrWillBeMember<TextTrackCue>>& o
utputCues) |
94 { | 94 { |
95 outputCues = m_cueList; | 95 ASSERT(outputCues.isEmpty()); |
96 m_cueList.clear(); | 96 outputCues.swap(m_cueList); |
97 } | 97 } |
98 | 98 |
99 void VTTParser::getNewRegions(WillBeHeapVector<RefPtrWillBeMember<VTTRegion>>& o
utputRegions) | 99 void VTTParser::getNewRegions(WillBeHeapVector<RefPtrWillBeMember<VTTRegion>>& o
utputRegions) |
100 { | 100 { |
101 outputRegions = m_regionList; | 101 ASSERT(outputRegions.isEmpty()); |
102 m_regionList.clear(); | 102 outputRegions.swap(m_regionList); |
103 } | 103 } |
104 | 104 |
105 void VTTParser::parseBytes(const char* data, unsigned length) | 105 void VTTParser::parseBytes(const char* data, unsigned length) |
106 { | 106 { |
107 String textData = m_decoder->decode(data, length); | 107 String textData = m_decoder->decode(data, length); |
108 m_lineReader.append(textData); | 108 m_lineReader.append(textData); |
109 parse(); | 109 parse(); |
110 } | 110 } |
111 | 111 |
112 void VTTParser::flush() | 112 void VTTParser::flush() |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 560 } |
561 | 561 |
562 DEFINE_TRACE(VTTParser) | 562 DEFINE_TRACE(VTTParser) |
563 { | 563 { |
564 visitor->trace(m_document); | 564 visitor->trace(m_document); |
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 } | 569 } |
OLD | NEW |