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 #include "media/base/media_log.h" | 5 #include "media/base/media_log.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "Media.WatchTime.AudioVideo.Background.Battery"; | 54 "Media.WatchTime.AudioVideo.Background.Battery"; |
55 const char MediaLog::kWatchTimeAudioVideoBackgroundAc[] = | 55 const char MediaLog::kWatchTimeAudioVideoBackgroundAc[] = |
56 "Media.WatchTime.AudioVideo.Background.AC"; | 56 "Media.WatchTime.AudioVideo.Background.AC"; |
57 const char MediaLog::kWatchTimeAudioVideoBackgroundEmbeddedExperience[] = | 57 const char MediaLog::kWatchTimeAudioVideoBackgroundEmbeddedExperience[] = |
58 "Media.WatchTime.AudioVideo.Background.EmbeddedExperience"; | 58 "Media.WatchTime.AudioVideo.Background.EmbeddedExperience"; |
59 | 59 |
60 const char MediaLog::kWatchTimeFinalize[] = "FinalizeWatchTime"; | 60 const char MediaLog::kWatchTimeFinalize[] = "FinalizeWatchTime"; |
61 const char MediaLog::kWatchTimeFinalizePower[] = "FinalizePowerWatchTime"; | 61 const char MediaLog::kWatchTimeFinalizePower[] = "FinalizePowerWatchTime"; |
62 | 62 |
63 base::flat_set<base::StringPiece> MediaLog::GetWatchTimeKeys() { | 63 base::flat_set<base::StringPiece> MediaLog::GetWatchTimeKeys() { |
64 return {kWatchTimeAudioAll, | 64 return base::flat_set<base::StringPiece>( |
65 kWatchTimeAudioMse, | 65 {kWatchTimeAudioAll, |
66 kWatchTimeAudioEme, | 66 kWatchTimeAudioMse, |
67 kWatchTimeAudioSrc, | 67 kWatchTimeAudioEme, |
68 kWatchTimeAudioBattery, | 68 kWatchTimeAudioSrc, |
69 kWatchTimeAudioAc, | 69 kWatchTimeAudioBattery, |
70 kWatchTimeAudioEmbeddedExperience, | 70 kWatchTimeAudioAc, |
71 kWatchTimeAudioVideoAll, | 71 kWatchTimeAudioEmbeddedExperience, |
72 kWatchTimeAudioVideoMse, | 72 kWatchTimeAudioVideoAll, |
73 kWatchTimeAudioVideoEme, | 73 kWatchTimeAudioVideoMse, |
74 kWatchTimeAudioVideoSrc, | 74 kWatchTimeAudioVideoEme, |
75 kWatchTimeAudioVideoBattery, | 75 kWatchTimeAudioVideoSrc, |
76 kWatchTimeAudioVideoAc, | 76 kWatchTimeAudioVideoBattery, |
77 kWatchTimeAudioVideoEmbeddedExperience, | 77 kWatchTimeAudioVideoAc, |
78 kWatchTimeAudioVideoBackgroundAll, | 78 kWatchTimeAudioVideoEmbeddedExperience, |
79 kWatchTimeAudioVideoBackgroundMse, | 79 kWatchTimeAudioVideoBackgroundAll, |
80 kWatchTimeAudioVideoBackgroundEme, | 80 kWatchTimeAudioVideoBackgroundMse, |
81 kWatchTimeAudioVideoBackgroundSrc, | 81 kWatchTimeAudioVideoBackgroundEme, |
82 kWatchTimeAudioVideoBackgroundBattery, | 82 kWatchTimeAudioVideoBackgroundSrc, |
83 kWatchTimeAudioVideoBackgroundAc, | 83 kWatchTimeAudioVideoBackgroundBattery, |
84 kWatchTimeAudioVideoBackgroundEmbeddedExperience}; | 84 kWatchTimeAudioVideoBackgroundAc, |
| 85 kWatchTimeAudioVideoBackgroundEmbeddedExperience}, |
| 86 base::KEEP_FIRST_OF_DUPES); |
85 } | 87 } |
86 | 88 |
87 base::flat_set<base::StringPiece> MediaLog::GetWatchTimePowerKeys() { | 89 base::flat_set<base::StringPiece> MediaLog::GetWatchTimePowerKeys() { |
88 return {kWatchTimeAudioBattery, | 90 return base::flat_set<base::StringPiece>( |
89 kWatchTimeAudioAc, | 91 {kWatchTimeAudioBattery, kWatchTimeAudioAc, kWatchTimeAudioVideoBattery, |
90 kWatchTimeAudioVideoBattery, | 92 kWatchTimeAudioVideoAc, kWatchTimeAudioVideoBackgroundBattery, |
91 kWatchTimeAudioVideoAc, | 93 kWatchTimeAudioVideoBackgroundAc}, |
92 kWatchTimeAudioVideoBackgroundBattery, | 94 base::KEEP_FIRST_OF_DUPES); |
93 kWatchTimeAudioVideoBackgroundAc}; | |
94 } | 95 } |
95 | 96 |
96 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) { | 97 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) { |
97 switch (level) { | 98 switch (level) { |
98 case MEDIALOG_ERROR: | 99 case MEDIALOG_ERROR: |
99 return "error"; | 100 return "error"; |
100 case MEDIALOG_INFO: | 101 case MEDIALOG_INFO: |
101 return "info"; | 102 return "info"; |
102 case MEDIALOG_DEBUG: | 103 case MEDIALOG_DEBUG: |
103 return "debug"; | 104 return "debug"; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 const scoped_refptr<MediaLog>& media_log) | 382 const scoped_refptr<MediaLog>& media_log) |
382 : level_(level), media_log_(media_log) { | 383 : level_(level), media_log_(media_log) { |
383 DCHECK(media_log_.get()); | 384 DCHECK(media_log_.get()); |
384 } | 385 } |
385 | 386 |
386 LogHelper::~LogHelper() { | 387 LogHelper::~LogHelper() { |
387 media_log_->AddLogEvent(level_, stream_.str()); | 388 media_log_->AddLogEvent(level_, stream_.str()); |
388 } | 389 } |
389 | 390 |
390 } //namespace media | 391 } //namespace media |
OLD | NEW |