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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // For AUTH_CHALLENGE_REPLY event. | 64 // For AUTH_CHALLENGE_REPLY event. |
65 void LogSocketChallengeReplyEvent(int channel_id, | 65 void LogSocketChallengeReplyEvent(int channel_id, |
66 const AuthResult& auth_result); | 66 const AuthResult& auth_result); |
67 | 67 |
68 void LogSocketEventForMessage(int channel_id, | 68 void LogSocketEventForMessage(int channel_id, |
69 proto::EventType event_type, | 69 proto::EventType event_type, |
70 const std::string& message_namespace, | 70 const std::string& message_namespace, |
71 const std::string& details); | 71 const std::string& details); |
72 | 72 |
73 // Assembles logs collected so far and return it as a serialized Log proto. | 73 // Assembles logs collected so far and return it as a serialized Log proto, |
74 // |output|: Where serialized contents will be assigned to. | 74 // compressed in gzip format. |
75 // Returns true if serialization is successful. | 75 // If serialization or compression failed, returns a NULL pointer. |
76 // Contents in |output| is valid only if function returns true. | 76 // |length|: If successful, assigned with size of compressed content. |
77 // TODO(imcheng): Add compression. | 77 scoped_ptr<char[]> GetLogs(size_t* length) const; |
78 bool LogToString(std::string* output) const; | |
79 | 78 |
80 // Clears the internal map. | 79 // Clears the internal map. |
81 void Reset(); | 80 void Reset(); |
82 | 81 |
83 // Returns the last errors logged for |channel_id|. If the the logs for | 82 // Returns the last errors logged for |channel_id|. If the the logs for |
84 // |channel_id| are evicted before this is called, returns a LastErrors with | 83 // |channel_id| are evicted before this is called, returns a LastErrors with |
85 // no errors. This may happen if errors are logged and retrieved in different | 84 // no errors. This may happen if errors are logged and retrieved in different |
86 // tasks. | 85 // tasks. |
87 LastErrors GetLastErrors(int channel_id) const; | 86 LastErrors GetLastErrors(int channel_id) const; |
88 | 87 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 132 |
134 base::ThreadChecker thread_checker_; | 133 base::ThreadChecker thread_checker_; |
135 | 134 |
136 DISALLOW_COPY_AND_ASSIGN(Logger); | 135 DISALLOW_COPY_AND_ASSIGN(Logger); |
137 }; | 136 }; |
138 } // namespace cast_channel | 137 } // namespace cast_channel |
139 } // namespace api | 138 } // namespace api |
140 } // namespace extensions | 139 } // namespace extensions |
141 | 140 |
142 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ | 141 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ |
OLD | NEW |