| OLD | NEW |
| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Stream_h | 31 #ifndef Stream_h |
| 32 #define Stream_h | 32 #define Stream_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 36 #include "heap/Handle.h" |
| 36 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 class ExecutionContext; | 44 class ExecutionContext; |
| 44 | 45 |
| 45 class Stream FINAL : public ScriptWrappable, public ActiveDOMObject, public RefC
ounted<Stream> { | 46 class Stream FINAL : public RefCountedWillBeRefCountedGarbageCollected<Stream>,
public ScriptWrappable, public ActiveDOMObject { |
| 46 public: | 47 public: |
| 47 static PassRefPtr<Stream> create(ExecutionContext* context, const String& me
diaType) | 48 static PassRefPtrWillBeRawPtr<Stream> create(ExecutionContext* context, cons
t String& mediaType) |
| 48 { | 49 { |
| 49 RefPtr<Stream> stream = adoptRef(new Stream(context, mediaType)); | 50 RefPtrWillBeRawPtr<Stream> stream = adoptRefWillBeRefCountedGarbageColle
cted(new Stream(context, mediaType)); |
| 50 stream->suspendIfNeeded(); | 51 stream->suspendIfNeeded(); |
| 51 return stream.release(); | 52 return stream.release(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 virtual ~Stream(); | 55 virtual ~Stream(); |
| 55 | 56 |
| 56 // Returns the internal URL referring to this stream. | 57 // Returns the internal URL referring to this stream. |
| 57 const KURL& url() const { return m_internalURL; } | 58 const KURL& url() const { return m_internalURL; } |
| 58 // Returns the media type of this stream. | 59 // Returns the media type of this stream. |
| 59 const String& type() const { return m_mediaType; } | 60 const String& type() const { return m_mediaType; } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 void neuter() { m_isNeutered = true; } | 74 void neuter() { m_isNeutered = true; } |
| 74 bool isNeutered() const { return m_isNeutered; } | 75 bool isNeutered() const { return m_isNeutered; } |
| 75 | 76 |
| 76 // Implementation of ActiveDOMObject. | 77 // Implementation of ActiveDOMObject. |
| 77 // | 78 // |
| 78 // FIXME: Implement suspend() and resume() when necessary. | 79 // FIXME: Implement suspend() and resume() when necessary. |
| 79 virtual void suspend() OVERRIDE; | 80 virtual void suspend() OVERRIDE; |
| 80 virtual void resume() OVERRIDE; | 81 virtual void resume() OVERRIDE; |
| 81 virtual void stop() OVERRIDE; | 82 virtual void stop() OVERRIDE; |
| 82 | 83 |
| 84 void trace(Visitor*) { } |
| 85 |
| 83 protected: | 86 protected: |
| 84 Stream(ExecutionContext*, const String& mediaType); | 87 Stream(ExecutionContext*, const String& mediaType); |
| 85 | 88 |
| 86 // This is an internal URL referring to the blob data associated with this o
bject. It serves | 89 // This is an internal URL referring to the blob data associated with this o
bject. It serves |
| 87 // as an identifier for this blob. The internal URL is never used to source
the blob's content | 90 // as an identifier for this blob. The internal URL is never used to source
the blob's content |
| 88 // into an HTML or for FileRead'ing, public blob URLs must be used for those
purposes. | 91 // into an HTML or for FileRead'ing, public blob URLs must be used for those
purposes. |
| 89 KURL m_internalURL; | 92 KURL m_internalURL; |
| 90 | 93 |
| 91 String m_mediaType; | 94 String m_mediaType; |
| 92 | 95 |
| 93 bool m_isNeutered; | 96 bool m_isNeutered; |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 } // namespace WebCore | 99 } // namespace WebCore |
| 97 | 100 |
| 98 #endif // Stream_h | 101 #endif // Stream_h |
| OLD | NEW |