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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Returns the internal URL referring to this stream. | 51 // Returns the internal URL referring to this stream. |
52 const KURL& url() const { return m_internalURL; } | 52 const KURL& url() const { return m_internalURL; } |
53 // Returns the media type of this stream. | 53 // Returns the media type of this stream. |
54 const String& type() const { return m_mediaType; } | 54 const String& type() const { return m_mediaType; } |
55 | 55 |
56 // Appends data to this stream. | 56 // Appends data to this stream. |
57 void addData(const char* data, size_t len); | 57 void addData(const char* data, size_t len); |
58 // Mark this stream finalized so that a reader of this stream is notified | 58 // Mark this stream finalized so that a reader of this stream is notified |
59 // of EOF. | 59 // of EOF. |
60 void finalize(); | 60 void finalize(); |
| 61 // Mark this stream finalized due to an error so that a reader of this |
| 62 // stream is notified of EOF due to the error. |
| 63 void abort(); |
61 | 64 |
62 // Allow an external reader class to mark this object neutered so that they | 65 // Allow an external reader class to mark this object neutered so that they |
63 // won't load the corresponding stream again. All stream objects are | 66 // won't load the corresponding stream again. All stream objects are |
64 // read-once for now. | 67 // read-once for now. |
65 void neuter() { m_isNeutered = true; } | 68 void neuter() { m_isNeutered = true; } |
66 bool isNeutered() const { return m_isNeutered; } | 69 bool isNeutered() const { return m_isNeutered; } |
67 | 70 |
68 protected: | 71 protected: |
69 explicit Stream(const String& mediaType); | 72 explicit Stream(const String& mediaType); |
70 | 73 |
71 // This is an internal URL referring to the blob data associated with this o
bject. It serves | 74 // This is an internal URL referring to the blob data associated with this o
bject. It serves |
72 // as an identifier for this blob. The internal URL is never used to source
the blob's content | 75 // as an identifier for this blob. The internal URL is never used to source
the blob's content |
73 // into an HTML or for FileRead'ing, public blob URLs must be used for those
purposes. | 76 // into an HTML or for FileRead'ing, public blob URLs must be used for those
purposes. |
74 KURL m_internalURL; | 77 KURL m_internalURL; |
75 | 78 |
76 String m_mediaType; | 79 String m_mediaType; |
77 | 80 |
78 bool m_isNeutered; | 81 bool m_isNeutered; |
79 }; | 82 }; |
80 | 83 |
81 } // namespace WebCore | 84 } // namespace WebCore |
82 | 85 |
83 #endif // Stream_h | 86 #endif // Stream_h |
OLD | NEW |