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

Side by Side Diff: extensions/browser/api/cast_channel/logger.h

Issue 670623002: Change base::TickClock to a ref counted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: y Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 10
(...skipping 19 matching lines...) Expand all
30 static const int kMaxSocketsToLog = 50; 30 static const int kMaxSocketsToLog = 50;
31 static const int kMaxEventsPerSocket = 2000; 31 static const int kMaxEventsPerSocket = 2000;
32 32
33 // Logs information of each channel and sockets and exports the log as 33 // Logs information of each channel and sockets and exports the log as
34 // a blob. Logger is done on the IO thread. 34 // a blob. Logger is done on the IO thread.
35 class Logger : public base::RefCounted<Logger> { 35 class Logger : public base::RefCounted<Logger> {
36 public: 36 public:
37 // |clock|: Clock used for generating timestamps for the events. Owned by 37 // |clock|: Clock used for generating timestamps for the events. Owned by
38 // this class. 38 // this class.
39 // |unix_epoch_time_ticks|: The TimeTicks that corresponds to Unix epoch. 39 // |unix_epoch_time_ticks|: The TimeTicks that corresponds to Unix epoch.
40 Logger(scoped_ptr<base::TickClock> clock, 40 Logger(const scoped_refptr<base::TickClock>&,
41 base::TimeTicks unix_epoch_time_ticks); 41 base::TimeTicks unix_epoch_time_ticks);
42 42
43 // For newly created sockets. Will create an event and log a 43 // For newly created sockets. Will create an event and log a
44 // CAST_SOCKET_CREATED event. 44 // CAST_SOCKET_CREATED event.
45 void LogNewSocketEvent(const CastSocket& cast_socket); 45 void LogNewSocketEvent(const CastSocket& cast_socket);
46 46
47 void LogSocketEvent(int channel_id, proto::EventType event_type); 47 void LogSocketEvent(int channel_id, proto::EventType event_type);
48 void LogSocketEventWithDetails(int channel_id, 48 void LogSocketEventWithDetails(int channel_id,
49 proto::EventType event_type, 49 proto::EventType event_type,
50 const std::string& details); 50 const std::string& details);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 proto::SocketEvent CreateEvent(proto::EventType event_type); 115 proto::SocketEvent CreateEvent(proto::EventType event_type);
116 116
117 // Records |event| associated with |channel_id|. 117 // Records |event| associated with |channel_id|.
118 // If the internal map is already logging maximum number of sockets and this 118 // If the internal map is already logging maximum number of sockets and this
119 // is a new socket, the socket with the smallest channel id will be discarded. 119 // is a new socket, the socket with the smallest channel id will be discarded.
120 // Returns a reference to the AggregatedSocketEvent proto created/modified. 120 // Returns a reference to the AggregatedSocketEvent proto created/modified.
121 proto::AggregatedSocketEvent& LogSocketEvent( 121 proto::AggregatedSocketEvent& LogSocketEvent(
122 int channel_id, 122 int channel_id,
123 const proto::SocketEvent& socket_event); 123 const proto::SocketEvent& socket_event);
124 124
125 scoped_ptr<base::TickClock> clock_; 125 scoped_refptr<base::TickClock> clock_;
126 AggregatedSocketEventLogMap aggregated_socket_events_; 126 AggregatedSocketEventLogMap aggregated_socket_events_;
127 base::TimeTicks unix_epoch_time_ticks_; 127 base::TimeTicks unix_epoch_time_ticks_;
128 128
129 // Log proto holding global statistics. 129 // Log proto holding global statistics.
130 proto::Log log_; 130 proto::Log log_;
131 131
132 base::ThreadChecker thread_checker_; 132 base::ThreadChecker thread_checker_;
133 133
134 DISALLOW_COPY_AND_ASSIGN(Logger); 134 DISALLOW_COPY_AND_ASSIGN(Logger);
135 }; 135 };
136 } // namespace cast_channel 136 } // namespace cast_channel
137 } // namespace api 137 } // namespace api
138 } // namespace extensions 138 } // namespace extensions
139 139
140 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ 140 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_api.cc ('k') | extensions/browser/api/cast_channel/logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698