OLD | NEW |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 typedef std::map<int, linked_ptr<AggregatedSocketEventLog> > | 110 typedef std::map<int, linked_ptr<AggregatedSocketEventLog> > |
111 AggregatedSocketEventLogMap; | 111 AggregatedSocketEventLogMap; |
112 | 112 |
113 // Returns a SocketEvent proto with common fields (EventType, timestamp) | 113 // Returns a SocketEvent proto with common fields (EventType, timestamp) |
114 // populated. | 114 // populated. |
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 pointer to the Event proto with |event_type| and | 120 // Returns a reference to the AggregatedSocketEvent proto created/modified. |
121 // timestamp populated. | 121 proto::AggregatedSocketEvent& LogSocketEvent( |
122 void LogSocketEvent(int channel_id, const proto::SocketEvent& socket_event); | 122 int channel_id, |
| 123 const proto::SocketEvent& socket_event); |
123 | 124 |
124 scoped_ptr<base::TickClock> clock_; | 125 scoped_ptr<base::TickClock> clock_; |
125 AggregatedSocketEventLogMap aggregated_socket_events_; | 126 AggregatedSocketEventLogMap aggregated_socket_events_; |
126 base::TimeTicks unix_epoch_time_ticks_; | 127 base::TimeTicks unix_epoch_time_ticks_; |
127 | 128 |
128 // Number of socket / event entries evicted by the logger due to size | 129 // Log proto holding global statistics. |
129 // constraints. | 130 proto::Log log_; |
130 int num_evicted_aggregated_socket_events_; | |
131 int num_evicted_socket_events_; | |
132 | 131 |
133 base::ThreadChecker thread_checker_; | 132 base::ThreadChecker thread_checker_; |
134 | 133 |
135 DISALLOW_COPY_AND_ASSIGN(Logger); | 134 DISALLOW_COPY_AND_ASSIGN(Logger); |
136 }; | 135 }; |
137 } // namespace cast_channel | 136 } // namespace cast_channel |
138 } // namespace api | 137 } // namespace api |
139 } // namespace extensions | 138 } // namespace extensions |
140 | 139 |
141 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ | 140 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ |
OLD | NEW |