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

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

Issue 8680036: Move ResourceResponse struct into the Content API, since it's used in Chrome. While at it, I also... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add gypi changes Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ 5 #ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "net/base/net_log.h" 11 #include "net/base/net_log.h"
12 #include "webkit/glue/resource_loader_bridge.h" 12 #include "webkit/glue/resource_loader_bridge.h"
13 13
14 namespace content {
15 struct ResourceResponse;
16 }
17
14 namespace net { 18 namespace net {
15 class URLRequest; 19 class URLRequest;
16 } // namespace net 20 } // namespace net
17 21
18 struct ResourceResponse;
19
20 // DevToolsNetLogObserver watches the NetLog event stream and collects the 22 // DevToolsNetLogObserver watches the NetLog event stream and collects the
21 // stuff that may be of interest to DevTools. Currently, this only includes 23 // stuff that may be of interest to DevTools. Currently, this only includes
22 // actual HTTP/SPDY headers sent and received over the network. 24 // actual HTTP/SPDY headers sent and received over the network.
23 // 25 //
24 // As DevToolsNetLogObserver shares live data with objects that live on the 26 // 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 27 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be
26 // called from other threads. 28 // called from other threads.
27 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver { 29 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver {
28 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; 30 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo;
29 31
(...skipping 22 matching lines...) Expand all
52 const net::NetLog::Source& source, 54 const net::NetLog::Source& source,
53 net::NetLog::EventPhase phase, 55 net::NetLog::EventPhase phase,
54 net::NetLog::EventParameters* params); 56 net::NetLog::EventParameters* params);
55 57
56 static void Attach(); 58 static void Attach();
57 static void Detach(); 59 static void Detach();
58 60
59 // Must be called on the IO thread. May return NULL if no observers 61 // Must be called on the IO thread. May return NULL if no observers
60 // are active. 62 // are active.
61 static DevToolsNetLogObserver* GetInstance(); 63 static DevToolsNetLogObserver* GetInstance();
62 static void PopulateResponseInfo(net::URLRequest*, ResourceResponse*); 64 static void PopulateResponseInfo(net::URLRequest*,
65 content::ResourceResponse*);
63 static int GetAndResetEncodedDataLength(net::URLRequest* request); 66 static int GetAndResetEncodedDataLength(net::URLRequest* request);
64 67
65 private: 68 private:
66 static DevToolsNetLogObserver* instance_; 69 static DevToolsNetLogObserver* instance_;
67 70
68 explicit DevToolsNetLogObserver(net::NetLog* net_log); 71 explicit DevToolsNetLogObserver(net::NetLog* net_log);
69 virtual ~DevToolsNetLogObserver(); 72 virtual ~DevToolsNetLogObserver();
70 73
71 ResourceInfo* GetResourceInfo(uint32 id); 74 ResourceInfo* GetResourceInfo(uint32 id);
72 75
73 net::NetLog* net_log_; 76 net::NetLog* net_log_;
74 typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap; 77 typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap;
75 typedef base::hash_map<uint32, int> RequestToEncodedDataLengthMap; 78 typedef base::hash_map<uint32, int> RequestToEncodedDataLengthMap;
76 typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap; 79 typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap;
77 typedef base::hash_map<uint32, uint32> SocketToRequestMap; 80 typedef base::hash_map<uint32, uint32> SocketToRequestMap;
78 RequestToInfoMap request_to_info_; 81 RequestToInfoMap request_to_info_;
79 RequestToEncodedDataLengthMap request_to_encoded_data_length_; 82 RequestToEncodedDataLengthMap request_to_encoded_data_length_;
80 HTTPStreamJobToSocketMap http_stream_job_to_socket_; 83 HTTPStreamJobToSocketMap http_stream_job_to_socket_;
81 SocketToRequestMap socket_to_request_; 84 SocketToRequestMap socket_to_request_;
82 85
83 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); 86 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver);
84 }; 87 };
85 88
86 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ 89 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/safe_browsing_resource_handler.cc ('k') | content/browser/debugger/devtools_netlog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698