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

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

Issue 2780533004: Start recording background video watch time. (Closed)
Patch Set: Fix copy-init issues. 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
« no previous file with comments | « content/browser/media/media_internals_unittest.cc ('k') | media/base/media_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include <memory> 11 #include <memory>
12 #include <sstream> 12 #include <sstream>
13 #include <string> 13 #include <string>
14 14
15 #include "base/containers/flat_set.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "media/base/buffering_state.h" 19 #include "media/base/buffering_state.h"
19 #include "media/base/media_export.h" 20 #include "media/base/media_export.h"
20 #include "media/base/media_log_event.h" 21 #include "media/base/media_log_event.h"
21 #include "media/base/pipeline_impl.h" 22 #include "media/base/pipeline_impl.h"
22 #include "media/base/pipeline_status.h" 23 #include "media/base/pipeline_status.h"
23 24
24 namespace media { 25 namespace media {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 // Report a log message at the specified log level. 85 // Report a log message at the specified log level.
85 void AddLogEvent(MediaLogLevel level, const std::string& message); 86 void AddLogEvent(MediaLogLevel level, const std::string& message);
86 87
87 // Report a property change without an accompanying event. 88 // Report a property change without an accompanying event.
88 void SetStringProperty(const std::string& key, const std::string& value); 89 void SetStringProperty(const std::string& key, const std::string& value);
89 void SetDoubleProperty(const std::string& key, double value); 90 void SetDoubleProperty(const std::string& key, double value);
90 void SetBooleanProperty(const std::string& key, bool value); 91 void SetBooleanProperty(const std::string& key, bool value);
91 92
92 // Histogram names used for reporting; also double as MediaLog key names. 93 // Histogram names used for reporting; also double as MediaLog key names.
94 // NOTE: If you add to this list you must update GetWatchTimeKeys() and if
95 // necessary, GetWatchTimePowerKeys().
93 static const char kWatchTimeAudioAll[]; 96 static const char kWatchTimeAudioAll[];
94 static const char kWatchTimeAudioMse[]; 97 static const char kWatchTimeAudioMse[];
95 static const char kWatchTimeAudioEme[]; 98 static const char kWatchTimeAudioEme[];
96 static const char kWatchTimeAudioSrc[]; 99 static const char kWatchTimeAudioSrc[];
97 static const char kWatchTimeAudioBattery[]; 100 static const char kWatchTimeAudioBattery[];
98 static const char kWatchTimeAudioAc[]; 101 static const char kWatchTimeAudioAc[];
99 static const char kWatchTimeAudioEmbeddedExperience[]; 102 static const char kWatchTimeAudioEmbeddedExperience[];
100 static const char kWatchTimeAudioVideoAll[]; 103 static const char kWatchTimeAudioVideoAll[];
101 static const char kWatchTimeAudioVideoMse[]; 104 static const char kWatchTimeAudioVideoMse[];
102 static const char kWatchTimeAudioVideoEme[]; 105 static const char kWatchTimeAudioVideoEme[];
103 static const char kWatchTimeAudioVideoSrc[]; 106 static const char kWatchTimeAudioVideoSrc[];
104 static const char kWatchTimeAudioVideoBattery[]; 107 static const char kWatchTimeAudioVideoBattery[];
105 static const char kWatchTimeAudioVideoAc[]; 108 static const char kWatchTimeAudioVideoAc[];
106 static const char kWatchTimeAudioVideoEmbeddedExperience[]; 109 static const char kWatchTimeAudioVideoEmbeddedExperience[];
110 static const char kWatchTimeAudioVideoBackgroundAll[];
111 static const char kWatchTimeAudioVideoBackgroundMse[];
112 static const char kWatchTimeAudioVideoBackgroundEme[];
113 static const char kWatchTimeAudioVideoBackgroundSrc[];
114 static const char kWatchTimeAudioVideoBackgroundBattery[];
115 static const char kWatchTimeAudioVideoBackgroundAc[];
116 static const char kWatchTimeAudioVideoBackgroundEmbeddedExperience[];
107 117
108 // Markers which signify the watch time should be finalized immediately. 118 // Markers which signify the watch time should be finalized immediately.
109 static const char kWatchTimeFinalize[]; 119 static const char kWatchTimeFinalize[];
110 static const char kWatchTimeFinalizePower[]; 120 static const char kWatchTimeFinalizePower[];
111 121
122 static base::flat_set<base::StringPiece> GetWatchTimeKeys();
123 static base::flat_set<base::StringPiece> GetWatchTimePowerKeys();
124
112 protected: 125 protected:
113 friend class base::RefCountedThreadSafe<MediaLog>; 126 friend class base::RefCountedThreadSafe<MediaLog>;
114 virtual ~MediaLog(); 127 virtual ~MediaLog();
115 128
116 private: 129 private:
117 // A unique (to this process) id for this MediaLog. 130 // A unique (to this process) id for this MediaLog.
118 int32_t id_; 131 int32_t id_;
119 132
120 DISALLOW_COPY_AND_ASSIGN(MediaLog); 133 DISALLOW_COPY_AND_ASSIGN(MediaLog);
121 }; 134 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ 169 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \
157 LAZY_STREAM(MEDIA_LOG(level, media_log), \ 170 LAZY_STREAM(MEDIA_LOG(level, media_log), \
158 (count) < (max) && ((count)++ || true)) \ 171 (count) < (max) && ((count)++ || true)) \
159 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ 172 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \
160 "may be suppressed): " \ 173 "may be suppressed): " \
161 : "") 174 : "")
162 175
163 } // namespace media 176 } // namespace media
164 177
165 #endif // MEDIA_BASE_MEDIA_LOG_H_ 178 #endif // MEDIA_BASE_MEDIA_LOG_H_
OLDNEW
« no previous file with comments | « content/browser/media/media_internals_unittest.cc ('k') | media/base/media_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698