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

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

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