| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 double MediaSourceBase::duration() const | 90 double MediaSourceBase::duration() const |
| 91 { | 91 { |
| 92 return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_private->dur
ation(); | 92 return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_private->dur
ation(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void MediaSourceBase::setDuration(double duration, ExceptionCode& ec) | 95 void MediaSourceBase::setDuration(double duration, ExceptionCode& ec) |
| 96 { | 96 { |
| 97 if (duration < 0.0 || std::isnan(duration)) { | 97 if (duration < 0.0 || std::isnan(duration)) { |
| 98 ec = INVALID_ACCESS_ERR; | 98 ec = InvalidAccessError; |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 if (!isOpen()) { | 101 if (!isOpen()) { |
| 102 ec = INVALID_STATE_ERR; | 102 ec = InvalidStateError; |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 m_private->setDuration(duration); | 105 m_private->setDuration(duration); |
| 106 } | 106 } |
| 107 | 107 |
| 108 | 108 |
| 109 void MediaSourceBase::setReadyState(const AtomicString& readyState) | 109 void MediaSourceBase::setReadyState(const AtomicString& readyState) |
| 110 { | 110 { |
| 111 m_readyState = readyState; | 111 m_readyState = readyState; |
| 112 | 112 |
| 113 if (isClosed()) | 113 if (isClosed()) |
| 114 m_private.clear(); | 114 m_private.clear(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionCode& ec) | 117 void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionCode& ec) |
| 118 { | 118 { |
| 119 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::C
onstructFromLiteral)); | 119 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::C
onstructFromLiteral)); |
| 120 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::Con
structFromLiteral)); | 120 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::Con
structFromLiteral)); |
| 121 | 121 |
| 122 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour
ce.html#dom-endofstream | 122 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour
ce.html#dom-endofstream |
| 123 // 1. If the readyState attribute is not in the "open" state then throw an | 123 // 1. If the readyState attribute is not in the "open" state then throw an |
| 124 // INVALID_STATE_ERR exception and abort these steps. | 124 // InvalidStateError exception and abort these steps. |
| 125 if (!isOpen()) { | 125 if (!isOpen()) { |
| 126 ec = INVALID_STATE_ERR; | 126 ec = InvalidStateError; |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoE
rror; | 130 MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoE
rror; |
| 131 | 131 |
| 132 if (error.isNull() || error.isEmpty()) { | 132 if (error.isNull() || error.isEmpty()) { |
| 133 eosStatus = MediaSourcePrivate::EosNoError; | 133 eosStatus = MediaSourcePrivate::EosNoError; |
| 134 } else if (error == network) { | 134 } else if (error == network) { |
| 135 eosStatus = MediaSourcePrivate::EosNetworkError; | 135 eosStatus = MediaSourcePrivate::EosNetworkError; |
| 136 } else if (error == decode) { | 136 } else if (error == decode) { |
| 137 eosStatus = MediaSourcePrivate::EosDecodeError; | 137 eosStatus = MediaSourcePrivate::EosDecodeError; |
| 138 } else { | 138 } else { |
| 139 ec = INVALID_ACCESS_ERR; | 139 ec = InvalidAccessError; |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 | 142 |
| 143 // 2. Change the readyState attribute value to "ended". | 143 // 2. Change the readyState attribute value to "ended". |
| 144 setReadyState(endedKeyword()); | 144 setReadyState(endedKeyword()); |
| 145 m_private->endOfStream(eosStatus); | 145 m_private->endOfStream(eosStatus); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool MediaSourceBase::isOpen() const | 148 bool MediaSourceBase::isOpen() const |
| 149 { | 149 { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 { | 242 { |
| 243 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 243 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
| 244 ActiveDOMObject::reportMemoryUsage(memoryObjectInfo); | 244 ActiveDOMObject::reportMemoryUsage(memoryObjectInfo); |
| 245 info.addMember(m_eventTargetData, "eventTargetData"); | 245 info.addMember(m_eventTargetData, "eventTargetData"); |
| 246 info.addMember(m_readyState, "readyState"); | 246 info.addMember(m_readyState, "readyState"); |
| 247 info.addMember(m_private, "private"); | 247 info.addMember(m_private, "private"); |
| 248 info.addMember(m_asyncEventQueue, "asyncEventQueue"); | 248 info.addMember(m_asyncEventQueue, "asyncEventQueue"); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } | 251 } |
| OLD | NEW |