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

Side by Side Diff: third_party/WebKit/Source/core/html/media/MediaError.h

Issue 2660003003: Add MediaError.message (Closed)
Patch Set: --flakiness by using std::map, update virtual/stable/[win,mac] global interface listing too Created 3 years, 8 months 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) 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
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 "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 JSONObject;
36 public ScriptWrappable { 37
38 class CORE_EXPORT MediaError final
39 : public GarbageCollectedFinalized<MediaError>,
40 public ScriptWrappable {
37 DEFINE_WRAPPERTYPEINFO(); 41 DEFINE_WRAPPERTYPEINFO();
38 42
39 public: 43 public:
40 enum ErrorCode { 44 enum ErrorCode {
41 kMediaErrAborted = 1, 45 kMediaErrAborted = 1,
42 kMediaErrNetwork, 46 kMediaErrNetwork,
43 kMediaErrDecode, 47 kMediaErrDecode,
44 kMediaErrSrcNotSupported, 48 kMediaErrSrcNotSupported,
45 }; 49 };
46 50
47 static MediaError* Create(ErrorCode code) { return new MediaError(code); } 51 static MediaError* Create(ErrorCode code, const JSONObject* messages) {
52 return new MediaError(code, messages);
53 }
48 54
49 ErrorCode code() const { return code_; } 55 ErrorCode code() const { return code_; }
50 56
57 // Returns either an empty string, or a serialized JSON object describing
58 // additional error messages. Each object property is named as an error type,
59 // with value being an array of error messages of that type.
60 String message() const { return message_; }
mlamouri (slow - plz ping) 2017/04/12 15:56:41 That's quite unexpected: why are we passing a JSON
foolip 2017/04/12 17:21:52 Yes, if we usually return a string that can be pas
wolenetz 2017/04/12 17:29:57 The format and content of the "message" attribute
foolip 2017/04/12 17:40:40 Can you share an example of what one of the more v
wolenetz 2017/04/13 23:59:10 Per discussion threads, redone as a human-readable
61
51 DEFINE_INLINE_TRACE() {} 62 DEFINE_INLINE_TRACE() {}
52 63
53 private: 64 private:
54 MediaError(ErrorCode code) : code_(code) {} 65 MediaError(ErrorCode, const JSONObject*);
55 66
56 ErrorCode code_; 67 ErrorCode code_;
68 String message_;
57 }; 69 };
58 70
59 } // namespace blink 71 } // namespace blink
60 72
61 #endif // MediaError_h 73 #endif // MediaError_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698