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

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

Issue 11630004: DevTools: rename debugger/ to devtools/, move DevTools files into content/renderer/devtools. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: For landing Created 8 years 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_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
7
8 #include "base/hash_tables.h"
9 #include "base/memory/ref_counted.h"
10 #include "net/base/net_log.h"
11 #include "webkit/glue/resource_loader_bridge.h"
12
13 namespace net {
14 class URLRequest;
15 } // namespace net
16
17 namespace content {
18 struct ResourceResponse;
19
20 // DevToolsNetLogObserver watches the NetLog event stream and collects the
21 // stuff that may be of interest to DevTools. Currently, this only includes
22 // actual HTTP/SPDY headers sent and received over the network.
23 //
24 // As DevToolsNetLogObserver shares live data with objects that live on the
25 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be
26 // called from other threads.
27 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
28 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo;
29
30 public:
31 // net::NetLog::ThreadSafeObserver implementation:
32 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE;
33
34 void OnAddURLRequestEntry(const net::NetLog::Entry& entry);
35 void OnAddHTTPStreamJobEntry(const net::NetLog::Entry& entry);
36 void OnAddSocketEntry(const net::NetLog::Entry& entry);
37
38 static void Attach();
39 static void Detach();
40
41 // Must be called on the IO thread. May return NULL if no observers
42 // are active.
43 static DevToolsNetLogObserver* GetInstance();
44 static void PopulateResponseInfo(net::URLRequest*,
45 ResourceResponse*);
46 static int GetAndResetEncodedDataLength(net::URLRequest* request);
47
48 private:
49 static DevToolsNetLogObserver* instance_;
50
51 DevToolsNetLogObserver();
52 virtual ~DevToolsNetLogObserver();
53
54 ResourceInfo* GetResourceInfo(uint32 id);
55
56 typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap;
57 typedef base::hash_map<uint32, int> RequestToEncodedDataLengthMap;
58 typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap;
59 typedef base::hash_map<uint32, uint32> SocketToRequestMap;
60 RequestToInfoMap request_to_info_;
61 RequestToEncodedDataLengthMap request_to_encoded_data_length_;
62 HTTPStreamJobToSocketMap http_stream_job_to_socket_;
63 SocketToRequestMap socket_to_request_;
64
65 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver);
66 };
67
68 } // namespace content
69
70 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_manager_unittest.cc ('k') | content/browser/debugger/devtools_netlog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698