OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_LOG_NET_LOG_H_ | 5 #ifndef NET_LOG_NET_LOG_H_ |
6 #define NET_LOG_NET_LOG_H_ | 6 #define NET_LOG_NET_LOG_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void DeprecatedRemoveObserver(ThreadSafeObserver* observer); | 147 void DeprecatedRemoveObserver(ThreadSafeObserver* observer); |
148 | 148 |
149 // Converts a time to the string format that the NetLog uses to represent | 149 // Converts a time to the string format that the NetLog uses to represent |
150 // times. Strings are used since integers may overflow. | 150 // times. Strings are used since integers may overflow. |
151 static std::string TickCountToString(const base::TimeTicks& time); | 151 static std::string TickCountToString(const base::TimeTicks& time); |
152 | 152 |
153 // Returns a C-String symbolic name for |event_type|. | 153 // Returns a C-String symbolic name for |event_type|. |
154 static const char* EventTypeToString(NetLogEventType event_type); | 154 static const char* EventTypeToString(NetLogEventType event_type); |
155 | 155 |
156 // Returns a dictionary that maps event type symbolic names to their enum | 156 // Returns a dictionary that maps event type symbolic names to their enum |
157 // values. Caller takes ownership of the returned Value. | 157 // values. |
158 static base::Value* GetEventTypesAsValue(); | 158 static std::unique_ptr<base::Value> GetEventTypesAsValue(); |
159 | 159 |
160 // Returns a C-String symbolic name for |source_type|. | 160 // Returns a C-String symbolic name for |source_type|. |
161 static const char* SourceTypeToString(NetLogSourceType source_type); | 161 static const char* SourceTypeToString(NetLogSourceType source_type); |
162 | 162 |
163 // Returns a dictionary that maps source type symbolic names to their enum | 163 // Returns a dictionary that maps source type symbolic names to their enum |
164 // values. Caller takes ownership of the returned Value. | 164 // values. |
165 static base::Value* GetSourceTypesAsValue(); | 165 static std::unique_ptr<base::Value> GetSourceTypesAsValue(); |
166 | 166 |
167 // Returns a C-String symbolic name for |event_phase|. | 167 // Returns a C-String symbolic name for |event_phase|. |
168 static const char* EventPhaseToString(NetLogEventPhase event_phase); | 168 static const char* EventPhaseToString(NetLogEventPhase event_phase); |
169 | 169 |
170 // Creates a NetLogParametersCallback that encapsulates a single bool. | 170 // Creates a NetLogParametersCallback that encapsulates a single bool. |
171 // Warning: |name| must remain valid for the life of the callback. | 171 // Warning: |name| must remain valid for the life of the callback. |
172 static NetLogParametersCallback BoolCallback(const char* name, bool value); | 172 static NetLogParametersCallback BoolCallback(const char* name, bool value); |
173 | 173 |
174 // Warning: |name| must remain valid for the life of the callback. | 174 // Warning: |name| must remain valid for the life of the callback. |
175 static NetLogParametersCallback IntCallback(const char* name, int value); | 175 static NetLogParametersCallback IntCallback(const char* name, int value); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // In practice |observers_| will be very small (<5) so O(n) | 231 // In practice |observers_| will be very small (<5) so O(n) |
232 // operations on it are fine. | 232 // operations on it are fine. |
233 std::vector<ThreadSafeObserver*> observers_; | 233 std::vector<ThreadSafeObserver*> observers_; |
234 | 234 |
235 DISALLOW_COPY_AND_ASSIGN(NetLog); | 235 DISALLOW_COPY_AND_ASSIGN(NetLog); |
236 }; | 236 }; |
237 | 237 |
238 } // namespace net | 238 } // namespace net |
239 | 239 |
240 #endif // NET_LOG_NET_LOG_H_ | 240 #endif // NET_LOG_NET_LOG_H_ |
OLD | NEW |