| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 bringElementUpToSpeed(element); | 77 bringElementUpToSpeed(element); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void MediaController::removeMediaElement(HTMLMediaElement* element) | 80 void MediaController::removeMediaElement(HTMLMediaElement* element) |
| 81 { | 81 { |
| 82 ASSERT(element); | 82 ASSERT(element); |
| 83 ASSERT(m_mediaElements.contains(element)); | 83 ASSERT(m_mediaElements.contains(element)); |
| 84 m_mediaElements.remove(m_mediaElements.find(element)); | 84 m_mediaElements.remove(m_mediaElements.find(element)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 PassRefPtrWillBeRawPtr<TimeRanges> MediaController::buffered() const | 87 TimeRanges* MediaController::buffered() const |
| 88 { | 88 { |
| 89 if (m_mediaElements.isEmpty()) | 89 if (m_mediaElements.isEmpty()) |
| 90 return TimeRanges::create(); | 90 return TimeRanges::create(); |
| 91 | 91 |
| 92 // The buffered attribute must return a new static normalized TimeRanges obj
ect that represents | 92 // The buffered attribute must return a new static normalized TimeRanges obj
ect that represents |
| 93 // the intersection of the ranges of the media resources of the slaved media
elements that the | 93 // the intersection of the ranges of the media resources of the slaved media
elements that the |
| 94 // user agent has buffered, at the time the attribute is evaluated. | 94 // user agent has buffered, at the time the attribute is evaluated. |
| 95 MediaElementSequence::const_iterator it = m_mediaElements.begin(); | 95 MediaElementSequence::const_iterator it = m_mediaElements.begin(); |
| 96 RefPtrWillBeRawPtr<TimeRanges> bufferedRanges = (*it)->buffered(); | 96 TimeRanges* bufferedRanges = (*it)->buffered(); |
| 97 for (++it; it != m_mediaElements.end(); ++it) | 97 for (++it; it != m_mediaElements.end(); ++it) |
| 98 bufferedRanges->intersectWith((*it)->buffered().get()); | 98 bufferedRanges->intersectWith((*it)->buffered()); |
| 99 return bufferedRanges; | 99 return bufferedRanges; |
| 100 } | 100 } |
| 101 | 101 |
| 102 PassRefPtrWillBeRawPtr<TimeRanges> MediaController::seekable() const | 102 TimeRanges* MediaController::seekable() const |
| 103 { | 103 { |
| 104 if (m_mediaElements.isEmpty()) | 104 if (m_mediaElements.isEmpty()) |
| 105 return TimeRanges::create(); | 105 return TimeRanges::create(); |
| 106 | 106 |
| 107 // The seekable attribute must return a new static normalized TimeRanges obj
ect that represents | 107 // The seekable attribute must return a new static normalized TimeRanges obj
ect that represents |
| 108 // the intersection of the ranges of the media resources of the slaved media
elements that the | 108 // the intersection of the ranges of the media resources of the slaved media
elements that the |
| 109 // user agent is able to seek to, at the time the attribute is evaluated. | 109 // user agent is able to seek to, at the time the attribute is evaluated. |
| 110 MediaElementSequence::const_iterator it = m_mediaElements.begin(); | 110 MediaElementSequence::const_iterator it = m_mediaElements.begin(); |
| 111 RefPtrWillBeRawPtr<TimeRanges> seekableRanges = (*it)->seekable(); | 111 TimeRanges* seekableRanges = (*it)->seekable(); |
| 112 for (++it; it != m_mediaElements.end(); ++it) | 112 for (++it; it != m_mediaElements.end(); ++it) |
| 113 seekableRanges->intersectWith((*it)->seekable().get()); | 113 seekableRanges->intersectWith((*it)->seekable()); |
| 114 return seekableRanges; | 114 return seekableRanges; |
| 115 } | 115 } |
| 116 | 116 |
| 117 PassRefPtrWillBeRawPtr<TimeRanges> MediaController::played() | 117 TimeRanges* MediaController::played() |
| 118 { | 118 { |
| 119 if (m_mediaElements.isEmpty()) | 119 if (m_mediaElements.isEmpty()) |
| 120 return TimeRanges::create(); | 120 return TimeRanges::create(); |
| 121 | 121 |
| 122 // The played attribute must return a new static normalized TimeRanges objec
t that represents | 122 // The played attribute must return a new static normalized TimeRanges objec
t that represents |
| 123 // the union of the ranges of the media resources of the slaved media elemen
ts that the | 123 // the union of the ranges of the media resources of the slaved media elemen
ts that the |
| 124 // user agent has so far rendered, at the time the attribute is evaluated. | 124 // user agent has so far rendered, at the time the attribute is evaluated. |
| 125 MediaElementSequence::const_iterator it = m_mediaElements.begin(); | 125 MediaElementSequence::const_iterator it = m_mediaElements.begin(); |
| 126 RefPtrWillBeRawPtr<TimeRanges> playedRanges = (*it)->played(); | 126 TimeRanges* playedRanges = (*it)->played(); |
| 127 for (++it; it != m_mediaElements.end(); ++it) | 127 for (++it; it != m_mediaElements.end(); ++it) |
| 128 playedRanges->unionWith((*it)->played().get()); | 128 playedRanges->unionWith((*it)->played()); |
| 129 return playedRanges; | 129 return playedRanges; |
| 130 } | 130 } |
| 131 | 131 |
| 132 double MediaController::duration() const | 132 double MediaController::duration() const |
| 133 { | 133 { |
| 134 // FIXME: Investigate caching the maximum duration and only updating the cac
hed value | 134 // FIXME: Investigate caching the maximum duration and only updating the cac
hed value |
| 135 // when the slaved media elements' durations change. | 135 // when the slaved media elements' durations change. |
| 136 double maxDuration = 0; | 136 double maxDuration = 0; |
| 137 for (const HTMLMediaElement* element : m_mediaElements) { | 137 for (const HTMLMediaElement* element : m_mediaElements) { |
| 138 double duration = element->duration(); | 138 double duration = element->duration(); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 { | 609 { |
| 610 #if ENABLE(OILPAN) | 610 #if ENABLE(OILPAN) |
| 611 visitor->trace(m_mediaElements); | 611 visitor->trace(m_mediaElements); |
| 612 visitor->trace(m_pendingEventsQueue); | 612 visitor->trace(m_pendingEventsQueue); |
| 613 visitor->trace(m_executionContext); | 613 visitor->trace(m_executionContext); |
| 614 #endif | 614 #endif |
| 615 RefCountedGarbageCollectedEventTargetWithInlineData<MediaController>::trace(
visitor); | 615 RefCountedGarbageCollectedEventTargetWithInlineData<MediaController>::trace(
visitor); |
| 616 } | 616 } |
| 617 | 617 |
| 618 } | 618 } |
| OLD | NEW |