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

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

Issue 61603006: Remove MediaSourcePrivate/SourceBufferPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: assert null 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/mediasource/MediaSource.h" 32 #include "modules/mediasource/MediaSource.h"
33 33
34 #include "bindings/v8/ExceptionState.h" 34 #include "bindings/v8/ExceptionState.h"
35 #include "bindings/v8/ExceptionStatePlaceholder.h" 35 #include "bindings/v8/ExceptionStatePlaceholder.h"
36 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
37 #include "core/events/GenericEventQueue.h" 37 #include "core/events/GenericEventQueue.h"
38 #include "core/html/TimeRanges.h" 38 #include "core/html/TimeRanges.h"
39 #include "modules/mediasource/MediaSourceRegistry.h"
39 #include "platform/ContentType.h" 40 #include "platform/ContentType.h"
40 #include "platform/Logging.h" 41 #include "platform/Logging.h"
41 #include "core/platform/graphics/SourceBufferPrivate.h"
42 #include "modules/mediasource/MediaSourceRegistry.h"
43 #include "platform/MIMETypeRegistry.h" 42 #include "platform/MIMETypeRegistry.h"
43 #include "public/platform/WebSourceBuffer.h"
44 #include "wtf/Uint8Array.h" 44 #include "wtf/Uint8Array.h"
45 #include "wtf/text/CString.h" 45 #include "wtf/text/CString.h"
46 46
47 using blink::WebSourceBuffer;
48
47 namespace WebCore { 49 namespace WebCore {
48 50
49 PassRefPtr<MediaSource> MediaSource::create(ExecutionContext* context) 51 PassRefPtr<MediaSource> MediaSource::create(ExecutionContext* context)
50 { 52 {
51 RefPtr<MediaSource> mediaSource(adoptRef(new MediaSource(context))); 53 RefPtr<MediaSource> mediaSource(adoptRef(new MediaSource(context)));
52 mediaSource->suspendIfNeeded(); 54 mediaSource->suspendIfNeeded();
53 return mediaSource.release(); 55 return mediaSource.release();
54 } 56 }
55 57
56 MediaSource::MediaSource(ExecutionContext* context) 58 MediaSource::MediaSource(ExecutionContext* context)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // 4. If the readyState attribute is not in the "open" state then throw an 92 // 4. If the readyState attribute is not in the "open" state then throw an
91 // InvalidStateError exception and abort these steps. 93 // InvalidStateError exception and abort these steps.
92 if (!isOpen()) { 94 if (!isOpen()) {
93 es.throwUninformativeAndGenericDOMException(InvalidStateError); 95 es.throwUninformativeAndGenericDOMException(InvalidStateError);
94 return 0; 96 return 0;
95 } 97 }
96 98
97 // 5. Create a new SourceBuffer object and associated resources. 99 // 5. Create a new SourceBuffer object and associated resources.
98 ContentType contentType(type); 100 ContentType contentType(type);
99 Vector<String> codecs = contentType.codecs(); 101 Vector<String> codecs = contentType.codecs();
100 OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate( contentType.type(), codecs, es); 102 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, es);
101 103
102 if (!sourceBufferPrivate) { 104 if (!webSourceBuffer) {
103 ASSERT(es.code() == NotSupportedError || es.code() == QuotaExceededError ); 105 ASSERT(es.code() == NotSupportedError || es.code() == QuotaExceededError );
104 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. 106 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps.
105 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps 107 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps
106 return 0; 108 return 0;
107 } 109 }
108 110
109 RefPtr<SourceBuffer> buffer = SourceBuffer::create(sourceBufferPrivate.relea se(), this, asyncEventQueue()); 111 RefPtr<SourceBuffer> buffer = SourceBuffer::create(webSourceBuffer.release() , this, asyncEventQueue());
110 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. 112 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
111 m_sourceBuffers->add(buffer); 113 m_sourceBuffers->add(buffer);
112 m_activeSourceBuffers->add(buffer); 114 m_activeSourceBuffers->add(buffer);
113 // 7. Return the new object to the caller. 115 // 7. Return the new object to the caller.
114 return buffer.get(); 116 return buffer.get();
115 } 117 }
116 118
117 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& es) 119 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& es)
118 { 120 {
119 LOG(Media, "MediaSource::removeSourceBuffer() %p", this); 121 LOG(Media, "MediaSource::removeSourceBuffer() %p", this);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // 6. Return true. 209 // 6. Return true.
208 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs); 210 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs);
209 } 211 }
210 212
211 const AtomicString& MediaSource::interfaceName() const 213 const AtomicString& MediaSource::interfaceName() const
212 { 214 {
213 return EventTargetNames::MediaSource; 215 return EventTargetNames::MediaSource;
214 } 216 }
215 217
216 } // namespace WebCore 218 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/SourceBufferPrivate.h ('k') | Source/modules/mediasource/MediaSourceBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698