Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 | |
| 7 #include "modules/mediasource/TrackDefaultList.h" | |
| 8 | |
| 9 #include "bindings/core/v8/ExceptionState.h" | |
| 10 #include "core/dom/ExceptionCode.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 TrackDefault* TrackDefaultList::item(unsigned long index) const | |
| 15 { | |
| 16 // Per 06 Oct 2014 Editor's Draft | |
| 17 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source. html#widl-TrackDefaultList-TrackDefault-getter-unsigned-long-index | |
| 18 // When this method is invoked, the user agent must run the following steps: | |
| 19 // 1. If index is greater than or equal to the length attribute then return | |
| 20 // undefined and abort these steps. | |
| 21 if (index >= m_trackDefaults.size()) | |
| 22 return 0; | |
|
philipj_slow
2014/11/14 12:12:27
Without custom bindings, I'm guessing this will re
wolenetz
2014/12/03 01:09:56
See discussion outside this comment, in this CL.
| |
| 23 | |
| 24 // 2. Return the |index|'th TrackDefault object in the list. | |
| 25 return m_trackDefaults[index].get(); | |
| 26 } | |
| 27 | |
| 28 TrackDefaultList::TrackDefaultList(const Vector<TrackDefault>& trackDefaults, Ex ceptionState& exceptionState) | |
| 29 { | |
| 30 // Per 06 Oct 2014 Editor's Draft | |
| 31 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source. html#widl-ctor-TrackDefaultList--sequence-TrackDefault--trackDefaults | |
| 32 // When this method is invoked, the user agent must run the following steps: | |
| 33 // 1. If |trackDefaults| contains two or more TrackDefault objects with the | |
| 34 // same type and have byteStreamTrackID equal to an empty string, then | |
| 35 // throw an INVALID_ACCESS_ERR and abort these steps. | |
| 36 // Note: This ensures that there is only one "byteStreamTrackID | |
| 37 // independent" default for each TrackDefaultType value. | |
| 38 // FIXME: What if two same non-empty track ID entries have the same type? | |
| 39 // This could lead to ambiguity in the default track {language, label, | |
| 40 // kinds} algorithms. This seems to be a spec bug. Pinged acolwell@ 04 Nov | |
| 41 // 2014. | |
| 42 // BIG TODO: implement | |
| 43 | |
| 44 // 2. Store a copy of |trackDefaults| in this new object so the values can | |
| 45 // be returned by the accessor methods. | |
| 46 // BIG TODO: test this, and test that a subsequent change of the initial con structor | |
| 47 // sequence parameter does NOT change the contents of this list. | |
| 48 // BIG TODO: implement | |
| 49 } | |
| 50 | |
| 51 } // namespace blink | |
| OLD | NEW |