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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 // For AUTH_CHALLENGE_REPLY event. | 63 // For AUTH_CHALLENGE_REPLY event. |
64 void LogSocketChallengeReplyEvent(int channel_id, | 64 void LogSocketChallengeReplyEvent(int channel_id, |
65 const AuthResult& auth_result); | 65 const AuthResult& auth_result); |
66 | 66 |
67 void LogSocketEventForMessage(int channel_id, | 67 void LogSocketEventForMessage(int channel_id, |
68 proto::EventType event_type, | 68 proto::EventType event_type, |
69 const std::string& message_namespace, | 69 const std::string& message_namespace, |
70 const std::string& details); | 70 const std::string& details); |
71 | 71 |
72 // Assembles logs collected so far and return it as a serialized Log proto. | 72 // Assembles logs collected so far and return it as a serialized Log proto, |
73 // |output|: Where serialized contents will be assigned to. | 73 // compressed in gzip format. |
74 // Returns true if serialization is successful. | 74 // If serialization or compression failed, returns a NULL pointer. |
75 // Contents in |output| is valid only if function returns true. | 75 // |length|: If successful, assigned with size of compressed content. |
76 // TODO(imcheng): Add compression. | 76 scoped_ptr<char[]> GetLogs(int* length) const; |
Wez
2014/08/13 20:32:25
What's the rationale for changing this API from ha
imcheng
2014/08/13 20:46:04
The rationale is to avoid an extra copy when const
Wez
2014/08/14 18:51:23
Would it make sense to have GetLogs() return a sco
imcheng
2014/08/14 21:12:34
I think either way is fine. We can change it to ba
| |
77 bool LogToString(std::string* output) const; | |
78 | 77 |
79 // Clears the internal map. | 78 // Clears the internal map. |
80 void Reset(); | 79 void Reset(); |
81 | 80 |
82 private: | 81 private: |
83 friend class base::RefCounted<Logger>; | 82 friend class base::RefCounted<Logger>; |
84 ~Logger(); | 83 ~Logger(); |
85 | 84 |
86 struct AggregatedSocketEventLog { | 85 struct AggregatedSocketEventLog { |
87 public: | 86 public: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 | 122 |
124 base::ThreadChecker thread_checker_; | 123 base::ThreadChecker thread_checker_; |
125 | 124 |
126 DISALLOW_COPY_AND_ASSIGN(Logger); | 125 DISALLOW_COPY_AND_ASSIGN(Logger); |
127 }; | 126 }; |
128 } // namespace cast_channel | 127 } // namespace cast_channel |
129 } // namespace api | 128 } // namespace api |
130 } // namespace extensions | 129 } // namespace extensions |
131 | 130 |
132 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ | 131 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_H_ |
OLD | NEW |