| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void TextTrackLoader::notifyFinished(Resource* resource) | 93 void TextTrackLoader::notifyFinished(Resource* resource) |
| 94 { | 94 { |
| 95 ASSERT(this->resource() == resource); | 95 ASSERT(this->resource() == resource); |
| 96 if (m_state != Failed) | 96 if (m_state != Failed) |
| 97 m_state = resource->errorOccurred() ? Failed : Finished; | 97 m_state = resource->errorOccurred() ? Failed : Finished; |
| 98 | 98 |
| 99 if (m_state == Finished && m_cueParser) | 99 if (m_state == Finished && m_cueParser) |
| 100 m_cueParser->flush(); | 100 m_cueParser->flush(); |
| 101 | 101 |
| 102 if (!m_cueLoadTimer.isActive()) | 102 if (!m_cueLoadTimer.isActive()) |
| 103 m_cueLoadTimer.startOneShot(0, FROM_HERE); | 103 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 104 | 104 |
| 105 cancelLoad(); | 105 cancelLoad(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool TextTrackLoader::load(const KURL& url, const AtomicString& crossOriginMode) | 108 bool TextTrackLoader::load(const KURL& url, const AtomicString& crossOriginMode) |
| 109 { | 109 { |
| 110 cancelLoad(); | 110 cancelLoad(); |
| 111 | 111 |
| 112 FetchRequest cueRequest(ResourceRequest(document().completeURL(url)), FetchI
nitiatorTypeNames::texttrack); | 112 FetchRequest cueRequest(ResourceRequest(document().completeURL(url)), FetchI
nitiatorTypeNames::texttrack); |
| 113 | 113 |
| 114 if (!crossOriginMode.isNull()) { | 114 if (!crossOriginMode.isNull()) { |
| 115 cueRequest.setCrossOriginAccessControl(document().securityOrigin(), cros
sOriginMode); | 115 cueRequest.setCrossOriginAccessControl(document().securityOrigin(), cros
sOriginMode); |
| 116 } else if (!document().securityOrigin()->canRequestNoSuborigin(url)) { | 116 } else if (!document().securityOrigin()->canRequestNoSuborigin(url)) { |
| 117 // Text track elements without 'crossorigin' set on the parent are "No C
ORS"; report error if not same-origin. | 117 // Text track elements without 'crossorigin' set on the parent are "No C
ORS"; report error if not same-origin. |
| 118 corsPolicyPreventedLoad(document().securityOrigin(), url); | 118 corsPolicyPreventedLoad(document().securityOrigin(), url); |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 ResourceFetcher* fetcher = document().fetcher(); | 122 ResourceFetcher* fetcher = document().fetcher(); |
| 123 setResource(RawResource::fetchTextTrack(cueRequest, fetcher)); | 123 setResource(RawResource::fetchTextTrack(cueRequest, fetcher)); |
| 124 return resource(); | 124 return resource(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void TextTrackLoader::newCuesParsed() | 127 void TextTrackLoader::newCuesParsed() |
| 128 { | 128 { |
| 129 if (m_cueLoadTimer.isActive()) | 129 if (m_cueLoadTimer.isActive()) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 m_newCuesAvailable = true; | 132 m_newCuesAvailable = true; |
| 133 m_cueLoadTimer.startOneShot(0, FROM_HERE); | 133 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void TextTrackLoader::newRegionsParsed() | 136 void TextTrackLoader::newRegionsParsed() |
| 137 { | 137 { |
| 138 m_client.newRegionsAvailable(this); | 138 m_client.newRegionsAvailable(this); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void TextTrackLoader::fileFailedToParse() | 141 void TextTrackLoader::fileFailedToParse() |
| 142 { | 142 { |
| 143 WTF_LOG(Media, "TextTrackLoader::fileFailedToParse"); | 143 WTF_LOG(Media, "TextTrackLoader::fileFailedToParse"); |
| 144 | 144 |
| 145 m_state = Failed; | 145 m_state = Failed; |
| 146 | 146 |
| 147 if (!m_cueLoadTimer.isActive()) | 147 if (!m_cueLoadTimer.isActive()) |
| 148 m_cueLoadTimer.startOneShot(0, FROM_HERE); | 148 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 149 | 149 |
| 150 cancelLoad(); | 150 cancelLoad(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void TextTrackLoader::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) | 153 void TextTrackLoader::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) |
| 154 { | 154 { |
| 155 ASSERT(m_cueParser); | 155 ASSERT(m_cueParser); |
| 156 if (m_cueParser) | 156 if (m_cueParser) |
| 157 m_cueParser->getNewCues(outputCues); | 157 m_cueParser->getNewCues(outputCues); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void TextTrackLoader::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions
) | 160 void TextTrackLoader::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions
) |
| 161 { | 161 { |
| 162 ASSERT(m_cueParser); | 162 ASSERT(m_cueParser); |
| 163 if (m_cueParser) | 163 if (m_cueParser) |
| 164 m_cueParser->getNewRegions(outputRegions); | 164 m_cueParser->getNewRegions(outputRegions); |
| 165 } | 165 } |
| 166 | 166 |
| 167 DEFINE_TRACE(TextTrackLoader) | 167 DEFINE_TRACE(TextTrackLoader) |
| 168 { | 168 { |
| 169 visitor->trace(m_cueParser); | 169 visitor->trace(m_cueParser); |
| 170 visitor->trace(m_document); | 170 visitor->trace(m_document); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } | 173 } |
| OLD | NEW |