Chromium Code Reviews| Index: Source/modules/mediasource/TrackDefaultList.cpp |
| diff --git a/Source/modules/mediasource/TrackDefaultList.cpp b/Source/modules/mediasource/TrackDefaultList.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..553b0c4d371e6bbee95097b3d1b8a40026dc5e45 |
| --- /dev/null |
| +++ b/Source/modules/mediasource/TrackDefaultList.cpp |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| + |
| +#include "modules/mediasource/TrackDefaultList.h" |
| + |
| +#include "bindings/core/v8/ExceptionState.h" |
| +#include "core/dom/ExceptionCode.h" |
| + |
| +namespace blink { |
| + |
| +TrackDefault* TrackDefaultList::item(unsigned long index) const |
| +{ |
| + // Per 06 Oct 2014 Editor's Draft |
| + // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-TrackDefaultList-TrackDefault-getter-unsigned-long-index |
| + // When this method is invoked, the user agent must run the following steps: |
| + // 1. If index is greater than or equal to the length attribute then return |
| + // undefined and abort these steps. |
| + if (index >= m_trackDefaults.size()) |
| + 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.
|
| + |
| + // 2. Return the |index|'th TrackDefault object in the list. |
| + return m_trackDefaults[index].get(); |
| +} |
| + |
| +TrackDefaultList::TrackDefaultList(const Vector<TrackDefault>& trackDefaults, ExceptionState& exceptionState) |
| +{ |
| + // Per 06 Oct 2014 Editor's Draft |
| + // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-ctor-TrackDefaultList--sequence-TrackDefault--trackDefaults |
| + // When this method is invoked, the user agent must run the following steps: |
| + // 1. If |trackDefaults| contains two or more TrackDefault objects with the |
| + // same type and have byteStreamTrackID equal to an empty string, then |
| + // throw an INVALID_ACCESS_ERR and abort these steps. |
| + // Note: This ensures that there is only one "byteStreamTrackID |
| + // independent" default for each TrackDefaultType value. |
| + // FIXME: What if two same non-empty track ID entries have the same type? |
| + // This could lead to ambiguity in the default track {language, label, |
| + // kinds} algorithms. This seems to be a spec bug. Pinged acolwell@ 04 Nov |
| + // 2014. |
| + // BIG TODO: implement |
| + |
| + // 2. Store a copy of |trackDefaults| in this new object so the values can |
| + // be returned by the accessor methods. |
| + // BIG TODO: test this, and test that a subsequent change of the initial constructor |
| + // sequence parameter does NOT change the contents of this list. |
| + // BIG TODO: implement |
| +} |
| + |
| +} // namespace blink |