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

Side by Side Diff: media/cast/logging/logging_impl.h

Issue 69603002: Incorporating logging into Cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing errors 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ 4 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ 5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
6 6
7 // Generic class that handles event logging for the cast library. 7 // Generic class that handles event logging for the cast library.
8 // Logging has three possible optional forms: 8 // Logging has three possible optional forms:
9 // 1. Raw data and stats accessible by the application. 9 // 1. Raw data and stats accessible by the application.
10 // 2. UMA stats. 10 // 2. UMA stats.
11 // 3. Tracing of raw events. 11 // 3. Tracing of raw events.
12 12
13 #include "base/memory/ref_counted.h"
14 #include "base/task_runner.h"
13 #include "media/cast/logging/logging_defines.h" 15 #include "media/cast/logging/logging_defines.h"
14 #include "media/cast/logging/logging_raw.h" 16 #include "media/cast/logging/logging_raw.h"
15 #include "media/cast/logging/logging_stats.h" 17 #include "media/cast/logging/logging_stats.h"
16 18
17 namespace media { 19 namespace media {
18 namespace cast { 20 namespace cast {
19 21
20 class LoggingImpl { 22 static const int kFrameIdUnknown = -1;
23 // Should only be called from the main thread.
24 class LoggingImpl : public base::NonThreadSafe {
21 public: 25 public:
22 LoggingImpl(base::TickClock* clock, 26 LoggingImpl(base::TickClock* clock,
27 scoped_refptr<base::TaskRunner> main_thread_proxy,
23 bool enable_data_collection, 28 bool enable_data_collection,
24 bool enable_uma_stats, 29 bool enable_uma_stats,
25 bool enable_tracing); 30 bool enable_tracing);
26 31
27 ~LoggingImpl(); 32 ~LoggingImpl();
28 33
29 void InsertFrameEvent(CastLoggingEvent event, 34 void InsertFrameEvent(CastLoggingEvent event,
30 uint32 rtp_timestamp, 35 uint32 rtp_timestamp,
31 uint8 frame_id); 36 uint8 frame_id);
32 void InsertFrameEventWithSize(CastLoggingEvent event, 37 void InsertFrameEventWithSize(CastLoggingEvent event,
33 uint32 rtp_timestamp, 38 uint32 rtp_timestamp,
34 uint8 frame_id, 39 uint8 frame_id,
35 int frame_size); 40 int frame_size);
36 void InsertFrameEventWithDelay(CastLoggingEvent event, 41 void InsertFrameEventWithDelay(CastLoggingEvent event,
37 uint32 rtp_timestamp, 42 uint32 rtp_timestamp,
38 uint8 frame_id, 43 uint8 frame_id,
39 base::TimeDelta delay); 44 base::TimeDelta delay);
40 void InsertPacketEvent(CastLoggingEvent event, 45 void InsertPacketEvent(CastLoggingEvent event,
41 uint32 rtp_timestamp, 46 uint32 rtp_timestamp,
42 uint8 frame_id, 47 uint8 frame_id,
43 uint16 packet_id, 48 uint16 packet_id,
44 uint16 max_packet_id, 49 uint16 max_packet_id,
45 int size); 50 size_t size);
46 void InsertGenericEvent(CastLoggingEvent event, int value); 51 void InsertGenericEvent(CastLoggingEvent event, int value);
47 52
48 // Get raw data. 53 // Get raw data.
49 FrameRawMap GetFrameRawData(); 54 FrameRawMap GetFrameRawData();
50 PacketRawMap GetPacketRawData(); 55 PacketRawMap GetPacketRawData();
51 GenericRawMap GetGenericRawData(); 56 GenericRawMap GetGenericRawData();
52 // Get stats only (computed when called). Triggers UMA stats when enabled. 57 // Get stats only (computed when called). Triggers UMA stats when enabled.
53 const FrameStatsMap* GetFrameStatsData(); 58 const FrameStatsMap* GetFrameStatsData();
54 const PacketStatsMap* GetPacketStatsData(); 59 const PacketStatsMap* GetPacketStatsData();
55 const GenericStatsMap* GetGenericStatsData(); 60 const GenericStatsMap* GetGenericStatsData();
56 61
57 void Reset(); 62 void Reset();
58 63
59 private: 64 private:
65 scoped_refptr<base::TaskRunner> main_thread_proxy_;
60 LoggingRaw raw_; 66 LoggingRaw raw_;
61 LoggingStats stats_; 67 LoggingStats stats_;
62 bool enable_data_collection_; 68 bool enable_data_collection_;
63 bool enable_uma_stats_; 69 bool enable_uma_stats_;
64 bool enable_tracing_; 70 bool enable_tracing_;
65 71
66 DISALLOW_COPY_AND_ASSIGN(LoggingImpl); 72 DISALLOW_COPY_AND_ASSIGN(LoggingImpl);
67 }; 73 };
68 74
69 } // namespace cast 75 } // namespace cast
70 } // namespace media 76 } // namespace media
71 77
72 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ 78 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698