summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-06 21:22:58 +0000
committervsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-06 21:22:58 +0000
commit697d4da62cfa3fe2ccfdcc216481990bd44de15c (patch)
tree1fc4e0f08815e2a135ba8c996c2346085ef7418e
parent95879ad33828c616347f2b063fe37aed08d8bad2 (diff)
downloadchromium_src-697d4da62cfa3fe2ccfdcc216481990bd44de15c.zip
chromium_src-697d4da62cfa3fe2ccfdcc216481990bd44de15c.tar.gz
chromium_src-697d4da62cfa3fe2ccfdcc216481990bd44de15c.tar.bz2
Removed bytes_received from ResourceDevToolsInfo since it is only used in devtools_netlog_observer.cc and belongs there.
Meanwhile renamed it to raw_data_length. BUG=40502 TEST=None Review URL: http://codereview.chromium.org/6804016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80697 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/debugger/devtools_netlog_observer.cc51
-rw-r--r--chrome/browser/debugger/devtools_netlog_observer.h6
-rw-r--r--webkit/glue/resource_loader_bridge.cc3
-rw-r--r--webkit/glue/resource_loader_bridge.h1
4 files changed, 41 insertions, 20 deletions
diff --git a/chrome/browser/debugger/devtools_netlog_observer.cc b/chrome/browser/debugger/devtools_netlog_observer.cc
index 451983d..8789de2 100644
--- a/chrome/browser/debugger/devtools_netlog_observer.cc
+++ b/chrome/browser/debugger/devtools_netlog_observer.cc
@@ -82,12 +82,22 @@ void DevToolsNetLogObserver::OnAddURLRequestEntry(
}
request_to_info_[source.id] = new ResourceInfo();
+
+ if (request_to_raw_data_length_.size() > kMaxNumEntries) {
+ LOG(WARNING) << "The raw data length observer url request count has "
+ "grown larger than expected, resetting";
+ request_to_raw_data_length_.clear();
+ }
+
+ request_to_raw_data_length_[source.id] = 0;
}
return;
} else if (type == net::NetLog::TYPE_REQUEST_ALIVE) {
// Cleanup records based on the TYPE_REQUEST_ALIVE entry.
- if (is_end)
+ if (is_end) {
request_to_info_.erase(source.id);
+ request_to_raw_data_length_.erase(source.id);
+ }
return;
}
@@ -126,7 +136,14 @@ void DevToolsNetLogObserver::OnAddURLRequestEntry(
if (it == http_stream_job_to_socket_.end())
return;
uint32 socket_id = it->second;
- socket_to_info_[socket_id] = info;
+
+ if (socket_to_request_.size() > kMaxNumEntries) {
+ LOG(WARNING) << "The url request observer socket count has grown "
+ "larger than expected, resetting";
+ socket_to_request_.clear();
+ }
+
+ socket_to_request_[socket_id] = source.id;
http_stream_job_to_socket_.erase(http_stream_job_id);
break;
}
@@ -168,16 +185,22 @@ void DevToolsNetLogObserver::OnAddSocketEntry(
bool is_end = phase == net::NetLog::PHASE_END;
- SocketToInfoMap::iterator it = socket_to_info_.find(source.id);
- if (it == socket_to_info_.end())
+ SocketToRequestMap::iterator it = socket_to_request_.find(source.id);
+ if (it == socket_to_request_.end())
return;
+ uint32 request_id = it->second;
if (type == net::NetLog::TYPE_SOCKET_IN_USE) {
if (is_end)
- socket_to_info_.erase(source.id);
+ socket_to_request_.erase(source.id);
return;
}
+ RequestToRawDataLengthMap::iterator raw_data_length_it =
+ request_to_raw_data_length_.find(request_id);
+ if (raw_data_length_it == request_to_raw_data_length_.end())
+ return;
+
if (net::NetLog::TYPE_SOCKET_BYTES_RECEIVED == type) {
int byte_count = 0;
Value* value = params->ToValue();
@@ -188,7 +211,7 @@ void DevToolsNetLogObserver::OnAddSocketEntry(
if (!dValue->GetInteger("byte_count", &byte_count))
return;
- it->second->bytes_received += byte_count;
+ raw_data_length_it->second += byte_count;
}
}
@@ -240,13 +263,11 @@ int DevToolsNetLogObserver::GetAndResetRawDataLength(
if (dev_tools_net_log_observer == NULL)
return -1;
- ResourceInfo* info =
- dev_tools_net_log_observer->GetResourceInfo(source_id);
-
- if (info != NULL) {
- int bytes_received = info->bytes_received;
- info->bytes_received = 0;
- return bytes_received;
- }
- return -1;
+ RequestToRawDataLengthMap::iterator it =
+ dev_tools_net_log_observer->request_to_raw_data_length_.find(source_id);
+ if (it == dev_tools_net_log_observer->request_to_raw_data_length_.end())
+ return -1;
+ int raw_data_length = it->second;
+ it->second = 0;
+ return raw_data_length;
}
diff --git a/chrome/browser/debugger/devtools_netlog_observer.h b/chrome/browser/debugger/devtools_netlog_observer.h
index 31892cd..830afca 100644
--- a/chrome/browser/debugger/devtools_netlog_observer.h
+++ b/chrome/browser/debugger/devtools_netlog_observer.h
@@ -73,11 +73,13 @@ class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver {
ChromeNetLog* chrome_net_log_;
typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap;
+ typedef base::hash_map<uint32, int> RequestToRawDataLengthMap;
typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap;
- typedef base::hash_map<uint32, ResourceInfo*> SocketToInfoMap;
+ typedef base::hash_map<uint32, uint32> SocketToRequestMap;
RequestToInfoMap request_to_info_;
+ RequestToRawDataLengthMap request_to_raw_data_length_;
HTTPStreamJobToSocketMap http_stream_job_to_socket_;
- SocketToInfoMap socket_to_info_;
+ SocketToRequestMap socket_to_request_;
DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver);
};
diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc
index 627f277..b757921 100644
--- a/webkit/glue/resource_loader_bridge.cc
+++ b/webkit/glue/resource_loader_bridge.cc
@@ -28,8 +28,7 @@ ResourceLoadTimingInfo::~ResourceLoadTimingInfo() {
}
ResourceDevToolsInfo::ResourceDevToolsInfo()
- : http_status_code(0),
- bytes_received(0) {
+ : http_status_code(0) {
}
ResourceDevToolsInfo::~ResourceDevToolsInfo() {}
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 35c76b3..e5f7d2e 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -110,7 +110,6 @@ struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> {
std::string http_status_text;
HeadersVector request_headers;
HeadersVector response_headers;
- int32 bytes_received;
};
struct ResourceResponseInfo {