| OLD | NEW |
| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <sstream> | 12 #include <sstream> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "media/base/buffering_state.h" | 18 #include "media/base/buffering_state.h" |
| 19 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
| 20 #include "media/base/media_log_event.h" | 20 #include "media/base/media_log_event.h" |
| 21 #include "media/base/pipeline_impl.h" | 21 #include "media/base/pipeline_impl.h" |
| 22 #include "media/base/pipeline_status.h" | 22 #include "media/base/pipeline_status.h" |
| 23 #include "url/gurl.h" |
| 23 | 24 |
| 24 namespace media { | 25 namespace media { |
| 25 | 26 |
| 26 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 27 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| 27 public: | 28 public: |
| 28 enum MediaLogLevel { | 29 enum MediaLogLevel { |
| 29 MEDIALOG_ERROR, | 30 MEDIALOG_ERROR, |
| 30 MEDIALOG_INFO, | 31 MEDIALOG_INFO, |
| 31 MEDIALOG_DEBUG, | 32 MEDIALOG_DEBUG, |
| 32 }; | 33 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 virtual void AddEvent(std::unique_ptr<MediaLogEvent> event); | 48 virtual void AddEvent(std::unique_ptr<MediaLogEvent> event); |
| 48 | 49 |
| 49 // Retrieve an error message, if any. | 50 // Retrieve an error message, if any. |
| 50 virtual std::string GetLastErrorMessage(); | 51 virtual std::string GetLastErrorMessage(); |
| 51 | 52 |
| 52 // Records the domain and registry of the current frame security origin to a | 53 // Records the domain and registry of the current frame security origin to a |
| 53 // Rappor privacy-preserving metric. See: | 54 // Rappor privacy-preserving metric. See: |
| 54 // https://www.chromium.org/developers/design-documents/rappor | 55 // https://www.chromium.org/developers/design-documents/rappor |
| 55 virtual void RecordRapporWithSecurityOrigin(const std::string& metric); | 56 virtual void RecordRapporWithSecurityOrigin(const std::string& metric); |
| 56 | 57 |
| 58 virtual void RecordRapporWithURL(const std::string& metric, const GURL& url); |
| 59 |
| 57 // Helper methods to create events and their parameters. | 60 // Helper methods to create events and their parameters. |
| 58 std::unique_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); | 61 std::unique_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); |
| 59 std::unique_ptr<MediaLogEvent> CreateBooleanEvent(MediaLogEvent::Type type, | 62 std::unique_ptr<MediaLogEvent> CreateBooleanEvent(MediaLogEvent::Type type, |
| 60 const std::string& property, | 63 const std::string& property, |
| 61 bool value); | 64 bool value); |
| 62 std::unique_ptr<MediaLogEvent> CreateStringEvent(MediaLogEvent::Type type, | 65 std::unique_ptr<MediaLogEvent> CreateStringEvent(MediaLogEvent::Type type, |
| 63 const std::string& property, | 66 const std::string& property, |
| 64 const std::string& value); | 67 const std::string& value); |
| 65 std::unique_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, | 68 std::unique_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, |
| 66 const std::string& property, | 69 const std::string& property, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ | 159 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ |
| 157 LAZY_STREAM(MEDIA_LOG(level, media_log), \ | 160 LAZY_STREAM(MEDIA_LOG(level, media_log), \ |
| 158 (count) < (max) && ((count)++ || true)) \ | 161 (count) < (max) && ((count)++ || true)) \ |
| 159 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ | 162 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ |
| 160 "may be suppressed): " \ | 163 "may be suppressed): " \ |
| 161 : "") | 164 : "") |
| 162 | 165 |
| 163 } // namespace media | 166 } // namespace media |
| 164 | 167 |
| 165 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 168 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
| OLD | NEW |