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

Unified Diff: media/cast/logging/logging_impl.cc

Issue 69603002: Incorporating logging into Cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/logging/logging_impl.cc
diff --git a/media/cast/logging/logging_impl.cc b/media/cast/logging/logging_impl.cc
index 7f91df273759417c021477a01262139828f233cd..175a15df28eee5eb98b8f3dd5f929d844b3cff54 100644
--- a/media/cast/logging/logging_impl.cc
+++ b/media/cast/logging/logging_impl.cc
@@ -10,10 +10,12 @@ namespace media {
namespace cast {
LoggingImpl::LoggingImpl(base::TickClock* clock,
+ scoped_refptr<base::TaskRunner> main_thread_proxy,
bool enable_data_collection,
bool enable_uma_stats,
bool enable_tracing)
- : enable_data_collection_(enable_data_collection),
+ : main_thread_proxy_(main_thread_proxy),
+ enable_data_collection_(enable_data_collection),
enable_uma_stats_(enable_uma_stats),
enable_tracing_(enable_tracing),
raw_(clock),
@@ -24,6 +26,7 @@ LoggingImpl::~LoggingImpl() {}
void LoggingImpl::InsertFrameEvent(CastLoggingEvent event,
uint32 rtp_timestamp,
uint8 frame_id) {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
if (enable_data_collection_) {
raw_.InsertFrameEvent(event, rtp_timestamp, frame_id);
stats_.InsertFrameEvent(event, rtp_timestamp, frame_id);
@@ -40,6 +43,7 @@ void LoggingImpl::InsertFrameEventWithSize(CastLoggingEvent event,
uint32 rtp_timestamp,
uint8 frame_id,
int frame_size) {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
if (enable_data_collection_) {
raw_.InsertFrameEventWithSize(event, rtp_timestamp, frame_id, frame_size);
stats_.InsertFrameEventWithSize(event, rtp_timestamp, frame_id, frame_size);
@@ -60,6 +64,7 @@ void LoggingImpl::InsertFrameEventWithDelay(CastLoggingEvent event,
uint32 rtp_timestamp,
uint8 frame_id,
base::TimeDelta delay) {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
if (enable_data_collection_) {
raw_.InsertFrameEventWithDelay(event, rtp_timestamp, frame_id, delay);
stats_.InsertFrameEventWithDelay(event, rtp_timestamp, frame_id, delay);
@@ -80,7 +85,8 @@ void LoggingImpl::InsertPacketEvent(CastLoggingEvent event,
uint8 frame_id,
uint16 packet_id,
uint16 max_packet_id,
- int size) {
+ size_t size) {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
if (enable_data_collection_) {
raw_.InsertPacketEvent(event, rtp_timestamp, frame_id, packet_id,
max_packet_id, size);
@@ -96,6 +102,7 @@ void LoggingImpl::InsertPacketEvent(CastLoggingEvent event,
}
void LoggingImpl::InsertGenericEvent(CastLoggingEvent event, int value) {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
if (enable_data_collection_) {
raw_.InsertGenericEvent(event, value);
stats_.InsertGenericEvent(event, value);
@@ -113,18 +120,22 @@ void LoggingImpl::InsertGenericEvent(CastLoggingEvent event, int value) {
// should just get the entire class, would be much easier.
FrameRawMap LoggingImpl::GetFrameRawData() {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
return raw_.GetFrameData();
}
PacketRawMap LoggingImpl::GetPacketRawData() {
- return raw_.GetPacketData();
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
+ return raw_.GetPacketData();
}
GenericRawMap LoggingImpl::GetGenericRawData() {
- return raw_.GetGenericData();
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
+ return raw_.GetGenericData();
}
const FrameStatsMap* LoggingImpl::GetFrameStatsData() {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
// Get stats data.
const FrameStatsMap* stats = stats_.GetFrameStatsData();
if (enable_uma_stats_) {
@@ -159,6 +170,7 @@ const FrameStatsMap* LoggingImpl::GetFrameStatsData() {
}
const PacketStatsMap* LoggingImpl::GetPacketStatsData() {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
// Get stats data.
const PacketStatsMap* stats = stats_.GetPacketStatsData();
if (enable_uma_stats_) {
@@ -174,6 +186,7 @@ const PacketStatsMap* LoggingImpl::GetPacketStatsData() {
}
const GenericStatsMap* LoggingImpl::GetGenericStatsData() {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
// Get stats data.
const GenericStatsMap* stats = stats_.GetGenericStatsData();
if (enable_uma_stats_) {
@@ -188,6 +201,7 @@ const GenericStatsMap* LoggingImpl::GetGenericStatsData() {
}
void LoggingImpl::Reset() {
+ DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread());
raw_.Reset();
stats_.Reset();
}

Powered by Google App Engine
This is Rietveld 408576698