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

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: 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 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 // Should only be called from the main thread.
23 class LoggingImpl : public base::NonThreadSafe {
21 public: 24 public:
22 LoggingImpl(base::TickClock* clock, 25 LoggingImpl(base::TickClock* clock,
26 scoped_refptr<base::TaskRunner> main_thread_proxy,
23 bool enable_data_collection, 27 bool enable_data_collection,
24 bool enable_uma_stats, 28 bool enable_uma_stats,
25 bool enable_tracing); 29 bool enable_tracing);
26 30
27 ~LoggingImpl(); 31 ~LoggingImpl();
28 32
29 void InsertFrameEvent(CastLoggingEvent event, 33 void InsertFrameEvent(CastLoggingEvent event,
30 uint32 rtp_timestamp, 34 uint32 rtp_timestamp,
31 uint8 frame_id); 35 uint8 frame_id);
32 void InsertFrameEventWithSize(CastLoggingEvent event, 36 void InsertFrameEventWithSize(CastLoggingEvent event,
33 uint32 rtp_timestamp, 37 uint32 rtp_timestamp,
34 uint8 frame_id, 38 uint8 frame_id,
35 int frame_size); 39 int frame_size);
36 void InsertFrameEventWithDelay(CastLoggingEvent event, 40 void InsertFrameEventWithDelay(CastLoggingEvent event,
37 uint32 rtp_timestamp, 41 uint32 rtp_timestamp,
38 uint8 frame_id, 42 uint8 frame_id,
39 base::TimeDelta delay); 43 base::TimeDelta delay);
40 void InsertPacketEvent(CastLoggingEvent event, 44 void InsertPacketEvent(CastLoggingEvent event,
41 uint32 rtp_timestamp, 45 uint32 rtp_timestamp,
42 uint8 frame_id, 46 uint8 frame_id,
43 uint16 packet_id, 47 uint16 packet_id,
44 uint16 max_packet_id, 48 uint16 max_packet_id,
45 int size); 49 size_t size);
46 void InsertGenericEvent(CastLoggingEvent event, int value); 50 void InsertGenericEvent(CastLoggingEvent event, int value);
47 51
48 // Get raw data. 52 // Get raw data.
49 FrameRawMap GetFrameRawData(); 53 FrameRawMap GetFrameRawData();
50 PacketRawMap GetPacketRawData(); 54 PacketRawMap GetPacketRawData();
51 GenericRawMap GetGenericRawData(); 55 GenericRawMap GetGenericRawData();
52 // Get stats only (computed when called). Triggers UMA stats when enabled. 56 // Get stats only (computed when called). Triggers UMA stats when enabled.
53 const FrameStatsMap* GetFrameStatsData(); 57 const FrameStatsMap* GetFrameStatsData();
54 const PacketStatsMap* GetPacketStatsData(); 58 const PacketStatsMap* GetPacketStatsData();
55 const GenericStatsMap* GetGenericStatsData(); 59 const GenericStatsMap* GetGenericStatsData();
56 60
57 void Reset(); 61 void Reset();
58 62
59 private: 63 private:
64 scoped_refptr<base::TaskRunner> main_thread_proxy_;
60 LoggingRaw raw_; 65 LoggingRaw raw_;
61 LoggingStats stats_; 66 LoggingStats stats_;
62 bool enable_data_collection_; 67 bool enable_data_collection_;
63 bool enable_uma_stats_; 68 bool enable_uma_stats_;
64 bool enable_tracing_; 69 bool enable_tracing_;
65 70
66 DISALLOW_COPY_AND_ASSIGN(LoggingImpl); 71 DISALLOW_COPY_AND_ASSIGN(LoggingImpl);
67 }; 72 };
68 73
69 } // namespace cast 74 } // namespace cast
70 } // namespace media 75 } // namespace media
71 76
72 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ 77 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698