Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Side by Side Diff: net/log/net_log_source.h

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_NET_LOG_SOURCE_H_
6 #define NET_LOG_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.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_NET_LOG_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698