Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 , m_newCuesAvailable(false) | 44 , m_newCuesAvailable(false) |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 TextTrackLoader::~TextTrackLoader() | 48 TextTrackLoader::~TextTrackLoader() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void TextTrackLoader::cueLoadTimerFired(TimerBase* timer) | 52 void TextTrackLoader::cueLoadTimerFired(TimerBase* timer) |
| 53 { | 53 { |
| 54 ASSERT_UNUSED(timer, timer == &m_cueLoadTimer); | 54 ALLOW_UNUSED_LOCAL(timer); |
|
yhirano
2016/09/12 04:33:14
ditto as Resource::cancelTimerFired.
hiroshige
2016/09/13 08:43:21
Done.
| |
| 55 DCHECK(timer == &m_cueLoadTimer); | |
|
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
| 55 | 56 |
| 56 if (m_newCuesAvailable) { | 57 if (m_newCuesAvailable) { |
| 57 m_newCuesAvailable = false; | 58 m_newCuesAvailable = false; |
| 58 m_client->newCuesAvailable(this); | 59 m_client->newCuesAvailable(this); |
| 59 } | 60 } |
| 60 | 61 |
| 61 if (m_state >= Finished) | 62 if (m_state >= Finished) |
| 62 m_client->cueLoadingCompleted(this, m_state == Failed); | 63 m_client->cueLoadingCompleted(this, m_state == Failed); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void TextTrackLoader::cancelLoad() | 66 void TextTrackLoader::cancelLoad() |
| 66 { | 67 { |
| 67 clearResource(); | 68 clearResource(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void TextTrackLoader::dataReceived(Resource* resource, const char* data, size_t length) | 71 void TextTrackLoader::dataReceived(Resource* resource, const char* data, size_t length) |
| 71 { | 72 { |
| 72 ASSERT(this->resource() == resource); | 73 DCHECK(this->resource() == resource); |
|
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
| 73 | 74 |
| 74 if (m_state == Failed) | 75 if (m_state == Failed) |
| 75 return; | 76 return; |
| 76 | 77 |
| 77 if (!m_cueParser) | 78 if (!m_cueParser) |
| 78 m_cueParser = VTTParser::create(this, document()); | 79 m_cueParser = VTTParser::create(this, document()); |
| 79 | 80 |
| 80 m_cueParser->parseBytes(data, length); | 81 m_cueParser->parseBytes(data, length); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void TextTrackLoader::corsPolicyPreventedLoad(SecurityOrigin* securityOrigin, co nst KURL& url) | 84 void TextTrackLoader::corsPolicyPreventedLoad(SecurityOrigin* securityOrigin, co nst KURL& url) |
| 84 { | 85 { |
| 85 String consoleMessage("Text track from origin '" + SecurityOrigin::create(ur l)->toString() + "' has been blocked from loading: Not at same origin as the doc ument, and parent of track element does not have a 'crossorigin' attribute. Orig in '" + securityOrigin->toString() + "' is therefore not allowed access."); | 86 String consoleMessage("Text track from origin '" + SecurityOrigin::create(ur l)->toString() + "' has been blocked from loading: Not at same origin as the doc ument, and parent of track element does not have a 'crossorigin' attribute. Orig in '" + securityOrigin->toString() + "' is therefore not allowed access."); |
| 86 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, E rrorMessageLevel, consoleMessage)); | 87 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, E rrorMessageLevel, consoleMessage)); |
| 87 m_state = Failed; | 88 m_state = Failed; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void TextTrackLoader::notifyFinished(Resource* resource) | 91 void TextTrackLoader::notifyFinished(Resource* resource) |
| 91 { | 92 { |
| 92 ASSERT(this->resource() == resource); | 93 DCHECK(this->resource() == resource); |
|
yhirano
2016/09/12 04:33:14
DCHECK_EQ
hiroshige
2016/09/13 08:43:21
Done.
| |
| 93 if (m_state != Failed) | 94 if (m_state != Failed) |
| 94 m_state = resource->errorOccurred() ? Failed : Finished; | 95 m_state = resource->errorOccurred() ? Failed : Finished; |
| 95 | 96 |
| 96 if (m_state == Finished && m_cueParser) | 97 if (m_state == Finished && m_cueParser) |
| 97 m_cueParser->flush(); | 98 m_cueParser->flush(); |
| 98 | 99 |
| 99 if (!m_cueLoadTimer.isActive()) | 100 if (!m_cueLoadTimer.isActive()) |
| 100 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); | 101 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 101 | 102 |
| 102 cancelLoad(); | 103 cancelLoad(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 m_state = Failed; | 141 m_state = Failed; |
| 141 | 142 |
| 142 if (!m_cueLoadTimer.isActive()) | 143 if (!m_cueLoadTimer.isActive()) |
| 143 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); | 144 m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 144 | 145 |
| 145 cancelLoad(); | 146 cancelLoad(); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void TextTrackLoader::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) | 149 void TextTrackLoader::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) |
| 149 { | 150 { |
| 150 ASSERT(m_cueParser); | 151 DCHECK(m_cueParser); |
| 151 if (m_cueParser) | 152 if (m_cueParser) |
| 152 m_cueParser->getNewCues(outputCues); | 153 m_cueParser->getNewCues(outputCues); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void TextTrackLoader::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions ) | 156 void TextTrackLoader::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions ) |
| 156 { | 157 { |
| 157 ASSERT(m_cueParser); | 158 DCHECK(m_cueParser); |
| 158 if (m_cueParser) | 159 if (m_cueParser) |
| 159 m_cueParser->getNewRegions(outputRegions); | 160 m_cueParser->getNewRegions(outputRegions); |
| 160 } | 161 } |
| 161 | 162 |
| 162 DEFINE_TRACE(TextTrackLoader) | 163 DEFINE_TRACE(TextTrackLoader) |
| 163 { | 164 { |
| 164 visitor->trace(m_client); | 165 visitor->trace(m_client); |
| 165 visitor->trace(m_cueParser); | 166 visitor->trace(m_cueParser); |
| 166 visitor->trace(m_document); | 167 visitor->trace(m_document); |
| 167 ResourceOwner<RawResource>::trace(visitor); | 168 ResourceOwner<RawResource>::trace(visitor); |
| 168 VTTParserClient::trace(visitor); | 169 VTTParserClient::trace(visitor); |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |