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

Side by Side Diff: content/browser/devtools/devtools_netlog_observer.h

Issue 1953593002: Move DevToolsNetLogObserver to c/b/loader and create stub of network service interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 7 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 (c) 2012 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 CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_
7
8 #include <stdint.h>
9
10 #include "base/containers/hash_tables.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "content/public/common/resource_devtools_info.h"
14 #include "net/log/net_log.h"
15
16 namespace net {
17 class URLRequest;
18 } // namespace net
19
20 namespace content {
21 struct ResourceResponse;
22
23 // DevToolsNetLogObserver watches the NetLog event stream and collects the
24 // stuff that may be of interest to DevTools. Currently, this only includes
25 // actual HTTP/SPDY headers sent and received over the network.
26 //
27 // As DevToolsNetLogObserver shares live data with objects that live on the
28 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be
29 // called from other threads.
30 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
31 typedef ResourceDevToolsInfo ResourceInfo;
32
33 public:
34 // net::NetLog::ThreadSafeObserver implementation:
35 void OnAddEntry(const net::NetLog::Entry& entry) override;
36
37 void OnAddURLRequestEntry(const net::NetLog::Entry& entry);
38
39 static void Attach();
40 static void Detach();
41
42 // Must be called on the IO thread. May return NULL if no observers
43 // are active.
44 static DevToolsNetLogObserver* GetInstance();
45 static void PopulateResponseInfo(net::URLRequest*,
46 ResourceResponse*);
47
48 private:
49 static DevToolsNetLogObserver* instance_;
50
51 DevToolsNetLogObserver();
52 ~DevToolsNetLogObserver() override;
53
54 ResourceInfo* GetResourceInfo(uint32_t id);
55
56 typedef base::hash_map<uint32_t, scoped_refptr<ResourceInfo>>
57 RequestToInfoMap;
58 RequestToInfoMap request_to_info_;
59
60 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver);
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_manager.cc ('k') | content/browser/devtools/devtools_netlog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698