OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_LOG_SOURCE_H_ | |
eroman
2016/10/03 21:40:51
NET_LOG_NET_LOG_SOURCE_H_
mikecirone
2016/10/03 23:38:25
Done, and I also added same "NET_LOG_" prefix for
| |
6 #define NET_LOG_SOURCE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "net/base/net_export.h" | |
11 #include "net/log/net_log_parameters_callback_typedef.h" | |
12 #include "net/log/net_log_source_type.h" | |
13 | |
14 namespace base { | |
15 class DictionaryValue; | |
16 class Value; | |
17 } | |
18 | |
19 namespace net { | |
20 | |
21 // Identifies the entity that generated this log. The |id| field should | |
22 // uniquely identify the source, and is used by log observers to infer | |
23 // message groupings. Can use NetLog::NextID() to create unique IDs. | |
24 struct NET_EXPORT NetLogSource { | |
25 static const uint32_t kInvalidId; | |
26 | |
27 NetLogSource(); | |
28 NetLogSource(NetLogSourceType type, uint32_t id); | |
29 bool IsValid() const; | |
30 | |
31 // Adds the source to a DictionaryValue containing event parameters, | |
32 // using the name "source_dependency". | |
33 void AddToEventParameters(base::DictionaryValue* event_params) const; | |
34 | |
35 // Returns a callback that returns a dictionary with a single entry | |
36 // named "source_dependency" that describes |this|. | |
37 NetLogParametersCallback ToEventParametersCallback() const; | |
38 | |
39 // Attempts to extract a NetLogSource from a set of event parameters. Returns | |
40 // true and writes the result to |source| on success. Returns false and | |
41 // makes |source| an invalid source on failure. | |
42 // TODO(mmenke): Long term, we want to remove this. | |
43 static bool FromEventParameters(base::Value* event_params, | |
44 NetLogSource* source); | |
45 | |
46 NetLogSourceType type; | |
47 uint32_t id; | |
48 }; | |
49 | |
50 } // namespace net | |
51 | |
52 #endif // NET_LOG_SOURCE_H_ | |
OLD | NEW |