Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef MediaError_h | 26 #ifndef MediaError_h |
| 27 #define MediaError_h | 27 #define MediaError_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 #include "platform/wtf/text/WTFString.h" | |
| 32 | 33 |
| 33 namespace blink { | 34 namespace blink { |
| 34 | 35 |
| 35 class CORE_EXPORT MediaError final : public GarbageCollected<MediaError>, | 36 class CORE_EXPORT MediaError final |
| 36 public ScriptWrappable { | 37 : public GarbageCollectedFinalized<MediaError>, |
|
mlamouri (slow - plz ping)
2017/04/21 10:26:24
Why Finalized? Finalized adds an overhead for the
wolenetz
2017/04/21 10:47:00
WTFString has a RefPtr private member, which IIUC
| |
| 38 public ScriptWrappable { | |
| 37 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
| 38 | 40 |
| 39 public: | 41 public: |
| 40 enum ErrorCode { | 42 enum ErrorCode { |
| 41 kMediaErrAborted = 1, | 43 kMediaErrAborted = 1, |
| 42 kMediaErrNetwork, | 44 kMediaErrNetwork, |
| 43 kMediaErrDecode, | 45 kMediaErrDecode, |
| 44 kMediaErrSrcNotSupported, | 46 kMediaErrSrcNotSupported, |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 static MediaError* Create(ErrorCode code) { return new MediaError(code); } | 49 static MediaError* Create(ErrorCode code, const String& message) { |
| 50 return new MediaError(code, message); | |
| 51 } | |
| 48 | 52 |
| 49 ErrorCode code() const { return code_; } | 53 ErrorCode code() const { return code_; } |
| 50 | 54 |
| 55 // Returns either an empty string, or a human readable string describing | |
| 56 // additional error detail. | |
| 57 String message() const { return message_; } | |
| 58 | |
| 51 DEFINE_INLINE_TRACE() {} | 59 DEFINE_INLINE_TRACE() {} |
| 52 | 60 |
| 53 private: | 61 private: |
| 54 MediaError(ErrorCode code) : code_(code) {} | 62 MediaError(ErrorCode code, const String& message) |
| 63 : code_(code), message_(message) {} | |
| 55 | 64 |
| 56 ErrorCode code_; | 65 ErrorCode code_; |
| 66 String message_; | |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 } // namespace blink | 69 } // namespace blink |
| 60 | 70 |
| 61 #endif // MediaError_h | 71 #endif // MediaError_h |
| OLD | NEW |