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

Side by Side Diff: Source/modules/mediasource/WebKitSourceBuffer.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WebKitSourceBuffer::~WebKitSourceBuffer() 58 WebKitSourceBuffer::~WebKitSourceBuffer()
59 { 59 {
60 } 60 }
61 61
62 PassRefPtr<TimeRanges> WebKitSourceBuffer::buffered(ExceptionState& es) const 62 PassRefPtr<TimeRanges> WebKitSourceBuffer::buffered(ExceptionState& es) const
63 { 63 {
64 // Section 3.1 buffered attribute steps. 64 // Section 3.1 buffered attribute steps.
65 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an 65 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an
66 // InvalidStateError exception and abort these steps. 66 // InvalidStateError exception and abort these steps.
67 if (isRemoved()) { 67 if (isRemoved()) {
68 es.throwDOMException(InvalidStateError); 68 es.throwUninformativeAndGenericDOMException(InvalidStateError);
69 return 0; 69 return 0;
70 } 70 }
71 71
72 // 2. Return a new static normalized TimeRanges object for the media segment s buffered. 72 // 2. Return a new static normalized TimeRanges object for the media segment s buffered.
73 return m_private->buffered(); 73 return m_private->buffered();
74 } 74 }
75 75
76 double WebKitSourceBuffer::timestampOffset() const 76 double WebKitSourceBuffer::timestampOffset() const
77 { 77 {
78 return m_timestampOffset; 78 return m_timestampOffset;
79 } 79 }
80 80
81 void WebKitSourceBuffer::setTimestampOffset(double offset, ExceptionState& es) 81 void WebKitSourceBuffer::setTimestampOffset(double offset, ExceptionState& es)
82 { 82 {
83 // Section 3.1 timestampOffset attribute setter steps. 83 // Section 3.1 timestampOffset attribute setter steps.
84 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an 84 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an
85 // InvalidStateError exception and abort these steps. 85 // InvalidStateError exception and abort these steps.
86 if (isRemoved()) { 86 if (isRemoved()) {
87 es.throwDOMException(InvalidStateError); 87 es.throwUninformativeAndGenericDOMException(InvalidStateError);
88 return; 88 return;
89 } 89 }
90 90
91 // 4. If the readyState attribute of the parent media source is in the "ende d" state then run the following steps: 91 // 4. If the readyState attribute of the parent media source is in the "ende d" state then run the following steps:
92 // 4.1 Set the readyState attribute of the parent media source to "open" 92 // 4.1 Set the readyState attribute of the parent media source to "open"
93 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me dia source. 93 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me dia source.
94 m_source->openIfInEndedState(); 94 m_source->openIfInEndedState();
95 95
96 // 5. If this object is waiting for the end of a media segment to be appende d, then throw an InvalidStateError 96 // 5. If this object is waiting for the end of a media segment to be appende d, then throw an InvalidStateError
97 // and abort these steps. 97 // and abort these steps.
98 if (!m_private->setTimestampOffset(offset)) { 98 if (!m_private->setTimestampOffset(offset)) {
99 es.throwDOMException(InvalidStateError); 99 es.throwUninformativeAndGenericDOMException(InvalidStateError);
100 return; 100 return;
101 } 101 }
102 102
103 // 6. Update the attribute to the new value. 103 // 6. Update the attribute to the new value.
104 m_timestampOffset = offset; 104 m_timestampOffset = offset;
105 } 105 }
106 106
107 void WebKitSourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionState& es) 107 void WebKitSourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionState& es)
108 { 108 {
109 // SourceBuffer.append() steps from October 1st version of the Media Source Extensions spec. 109 // SourceBuffer.append() steps from October 1st version of the Media Source Extensions spec.
110 // https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/medi a-source.html#dom-append 110 // https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/medi a-source.html#dom-append
111 111
112 // 2. If data is null then throw an InvalidAccessError exception and abort t hese steps. 112 // 2. If data is null then throw an InvalidAccessError exception and abort t hese steps.
113 if (!data) { 113 if (!data) {
114 es.throwDOMException(InvalidAccessError); 114 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
115 return; 115 return;
116 } 116 }
117 117
118 // 3. If this object has been removed from the sourceBuffers attribute of me dia source then throw 118 // 3. If this object has been removed from the sourceBuffers attribute of me dia source then throw
119 // an InvalidStateError exception and abort these steps. 119 // an InvalidStateError exception and abort these steps.
120 if (isRemoved()) { 120 if (isRemoved()) {
121 es.throwDOMException(InvalidStateError); 121 es.throwUninformativeAndGenericDOMException(InvalidStateError);
122 return; 122 return;
123 } 123 }
124 124
125 // 5. If the readyState attribute of media source is in the "ended" state th en run the following steps: 125 // 5. If the readyState attribute of media source is in the "ended" state th en run the following steps:
126 // 5.1. Set the readyState attribute of media source to "open" 126 // 5.1. Set the readyState attribute of media source to "open"
127 // 5.2. Queue a task to fire a simple event named sourceopen at media source . 127 // 5.2. Queue a task to fire a simple event named sourceopen at media source .
128 m_source->openIfInEndedState(); 128 m_source->openIfInEndedState();
129 129
130 // Steps 6 & beyond are handled by the private implementation. 130 // Steps 6 & beyond are handled by the private implementation.
131 m_private->append(data->data(), data->length()); 131 m_private->append(data->data(), data->length());
132 } 132 }
133 133
134 void WebKitSourceBuffer::abort(ExceptionState& es) 134 void WebKitSourceBuffer::abort(ExceptionState& es)
135 { 135 {
136 // Section 3.2 abort() method steps. 136 // Section 3.2 abort() method steps.
137 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source 137 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source
138 // then throw an InvalidStateError exception and abort these steps. 138 // then throw an InvalidStateError exception and abort these steps.
139 // 2. If the readyState attribute of the parent media source is not in the " open" state 139 // 2. If the readyState attribute of the parent media source is not in the " open" state
140 // then throw an InvalidStateError exception and abort these steps. 140 // then throw an InvalidStateError exception and abort these steps.
141 if (isRemoved() || !m_source->isOpen()) { 141 if (isRemoved() || !m_source->isOpen()) {
142 es.throwDOMException(InvalidStateError); 142 es.throwUninformativeAndGenericDOMException(InvalidStateError);
143 return; 143 return;
144 } 144 }
145 145
146 // 4. Run the reset parser state algorithm. 146 // 4. Run the reset parser state algorithm.
147 m_private->abort(); 147 m_private->abort();
148 } 148 }
149 149
150 void WebKitSourceBuffer::removedFromMediaSource() 150 void WebKitSourceBuffer::removedFromMediaSource()
151 { 151 {
152 if (isRemoved()) 152 if (isRemoved())
153 return; 153 return;
154 154
155 m_private->removedFromMediaSource(); 155 m_private->removedFromMediaSource();
156 m_source.clear(); 156 m_source.clear();
157 } 157 }
158 158
159 bool WebKitSourceBuffer::isRemoved() const 159 bool WebKitSourceBuffer::isRemoved() const
160 { 160 {
161 return !m_source; 161 return !m_source;
162 } 162 }
163 163
164 } // namespace WebCore 164 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediasource/WebKitMediaSource.cpp ('k') | Source/modules/mediastream/MediaConstraintsImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698