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

Side by Side Diff: media/base/media_log.h

Issue 2660003003: Add MediaError.message (Closed)
Patch Set: Update message format to be code: detail 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_
6 #define MEDIA_BASE_MEDIA_LOG_H_ 6 #define MEDIA_BASE_MEDIA_LOG_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 18 matching lines...) Expand all
29 enum MediaLogLevel { 29 enum MediaLogLevel {
30 MEDIALOG_ERROR, 30 MEDIALOG_ERROR,
31 MEDIALOG_INFO, 31 MEDIALOG_INFO,
32 MEDIALOG_DEBUG, 32 MEDIALOG_DEBUG,
33 }; 33 };
34 34
35 // Convert various enums to strings. 35 // Convert various enums to strings.
36 static std::string MediaLogLevelToString(MediaLogLevel level); 36 static std::string MediaLogLevelToString(MediaLogLevel level);
37 static MediaLogEvent::Type MediaLogLevelToEventType(MediaLogLevel level); 37 static MediaLogEvent::Type MediaLogLevelToEventType(MediaLogLevel level);
38 static std::string EventTypeToString(MediaLogEvent::Type type); 38 static std::string EventTypeToString(MediaLogEvent::Type type);
39
40 // Returns a string version of the status, unique to each PipelineStatus, and
41 // not including any ':'. This makes it suitable for usage in
42 // MediaError.message as the UA-specific-error-code.
39 static std::string PipelineStatusToString(PipelineStatus status); 43 static std::string PipelineStatusToString(PipelineStatus status);
44
40 static std::string BufferingStateToString(BufferingState state); 45 static std::string BufferingStateToString(BufferingState state);
41 46
42 static std::string MediaEventToLogString(const MediaLogEvent& event); 47 static std::string MediaEventToLogString(const MediaLogEvent& event);
43 48
49 // Returns a string usable as part of a MediaError.message, for only
50 // PIPELINE_ERROR or MEDIA_ERROR_LOG_ENTRY events, with any newlines replaced
51 // with whitespace in the latter kind of events.
52 static std::string MediaEventToMessageString(const MediaLogEvent& event);
53
44 MediaLog(); 54 MediaLog();
45 virtual ~MediaLog(); 55 virtual ~MediaLog();
46 56
47 // Add an event to this log. Overriden by inheritors to actually do something 57 // Add an event to this log. Overriden by inheritors to actually do something
48 // with it. 58 // with it.
49 virtual void AddEvent(std::unique_ptr<MediaLogEvent> event); 59 virtual void AddEvent(std::unique_ptr<MediaLogEvent> event);
50 60
51 // Retrieve an error message, if any. 61 virtual std::string GetErrorMessage();
52 virtual std::string GetLastErrorMessage();
53 62
54 // Records the domain and registry of the current frame security origin to a 63 // Records the domain and registry of the current frame security origin to a
55 // Rappor privacy-preserving metric. See: 64 // Rappor privacy-preserving metric. See:
56 // https://www.chromium.org/developers/design-documents/rappor 65 // https://www.chromium.org/developers/design-documents/rappor
57 virtual void RecordRapporWithSecurityOrigin(const std::string& metric); 66 virtual void RecordRapporWithSecurityOrigin(const std::string& metric);
58 67
59 // Helper methods to create events and their parameters. 68 // Helper methods to create events and their parameters.
60 std::unique_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); 69 std::unique_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type);
61 std::unique_ptr<MediaLogEvent> CreateBooleanEvent(MediaLogEvent::Type type, 70 std::unique_ptr<MediaLogEvent> CreateBooleanEvent(MediaLogEvent::Type type,
62 const std::string& property, 71 const std::string& property,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ 174 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \
166 LAZY_STREAM(MEDIA_LOG(level, media_log), \ 175 LAZY_STREAM(MEDIA_LOG(level, media_log), \
167 (count) < (max) && ((count)++ || true)) \ 176 (count) < (max) && ((count)++ || true)) \
168 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ 177 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \
169 "may be suppressed): " \ 178 "may be suppressed): " \
170 : "") 179 : "")
171 180
172 } // namespace media 181 } // namespace media
173 182
174 #endif // MEDIA_BASE_MEDIA_LOG_H_ 183 #endif // MEDIA_BASE_MEDIA_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698