Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: Source/core/html/track/DataCue.h

Issue 224833002: Implement DataCue interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2014, CableLabs Inc. All rights reserved.
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 nit: New files should have the Chromium header men
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of Opera Software ASA nor the names of its 12 * 3. Neither the name of Opera Software ASA nor the names of its
13 * contributors may be used to endorse or promote products derived 13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission. 14 * from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 20 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef SharedWorkerPerformance_h 30 #ifndef DataCue_h
31 #define SharedWorkerPerformance_h 31 #define DataCue_h
32 32
33 #include "heap/Handle.h" 33 #include "bindings/v8/ScriptWrappable.h"
34 #include "platform/Supplementable.h" 34 #include "core/html/track/TextTrackCue.h"
35 #include "wtf/ArrayBuffer.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 class ExecutionContext; 39 class ExecutionContext;
39 class SharedWorker;
40 40
41 class SharedWorkerPerformance FINAL : public NoBaseWillBeGarbageCollected<Shared WorkerPerformance>, public WillBeHeapSupplement<SharedWorker> { 41 class DataCue FINAL : public TextTrackCue, public ScriptWrappable {
42 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SharedWorkerPerformance);
43 public: 42 public:
44 static SharedWorkerPerformance& from(SharedWorker&); 43 static PassRefPtr<DataCue> create(ExecutionContext* context, double start, d ouble end, ArrayBuffer* data, ExceptionState& exceptionState)
44 {
45 return adoptRef(new DataCue(context, start, end, data, exceptionState));
sof 2014/04/04 19:11:31 Argument validation could with benefit be put here
Brendan Long 2014/04/04 19:37:51 The check is already done in setData() (which is u
46 }
45 47
46 static double workerStart(ExecutionContext*, SharedWorker&); 48 virtual ~DataCue();
47 double getWorkerStart(ExecutionContext*, SharedWorker&) const;
48 49
49 void trace(Visitor*) { } 50 PassRefPtr<ArrayBuffer> data() const;
51 void setData(ArrayBuffer*, ExceptionState&);
52 String text(bool& isNull) const;
53
54 virtual CueType cueType() const OVERRIDE { return Data; }
55
56 virtual ExecutionContext* executionContext() const OVERRIDE;
57
58 #ifndef NDEBUG
59 virtual String toString() const OVERRIDE;
60 #endif
61
62 protected:
63 DataCue(ExecutionContext*, double start, double end, ArrayBuffer*, Exception State&);
50 64
51 private: 65 private:
52 explicit SharedWorkerPerformance(); 66 ExecutionContext* m_executionContext;
53 static const char* supplementName(); 67 RefPtr<ArrayBuffer> m_data;
68 };
54 69
55 double m_timeOrigin; 70 // DataCue is currently the only TextTrackCue subclass.
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 nit: Remove comment since it is a lie. :)
56 }; 71 DEFINE_TYPE_CASTS(DataCue, TextTrackCue, cue, cue->cueType() == TextTrackCue::Da ta, cue.cueType() == TextTrackCue::Data);
57 72
58 } // namespace WebCore 73 } // namespace WebCore
59 74
60 #endif // SharedWorkerPerformance_h 75 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698