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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp

Issue 2519893002: Stop dispatching encoded-data-length on each data chunk arrival (Closed)
Patch Set: fix Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
index 89b751538085166dd2f2f59339d20e06ed896149..7af776779b0220a3a5eda71d30cd6438d156237c 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -725,7 +725,7 @@ void InspectorNetworkAgent::didReceiveResourceResponse(
// following didReceiveResponse as there will be no calls to didReceiveData
// from the network stack.
if (isNotModified && cachedResource && cachedResource->encodedSize())
- didReceiveData(frame, identifier, 0, cachedResource->encodedSize(), 0);
+ didReceiveData(frame, identifier, 0, cachedResource->encodedSize());
}
static bool isErrorStatusCode(int statusCode) {
@@ -735,8 +735,7 @@ static bool isErrorStatusCode(int statusCode) {
void InspectorNetworkAgent::didReceiveData(LocalFrame*,
unsigned long identifier,
const char* data,
- int dataLength,
- int encodedDataLength) {
+ int dataLength) {
String requestId = IdentifiersFactory::requestId(identifier);
if (data) {
@@ -750,8 +749,17 @@ void InspectorNetworkAgent::didReceiveData(LocalFrame*,
m_resourcesData->maybeAddResourceData(requestId, data, dataLength);
}
- frontend()->dataReceived(requestId, monotonicallyIncreasingTime(), dataLength,
- encodedDataLength);
+ frontend()->dataReceived(
+ requestId, monotonicallyIncreasingTime(), dataLength,
+ m_resourcesData->getAndClearPendingEncodedDataLength(requestId));
+}
+
+void InspectorNetworkAgent::didReceiveEncodedDataLength(
+ LocalFrame*,
+ unsigned long identifier,
+ int encodedDataLength) {
+ String requestId = IdentifiersFactory::requestId(identifier);
+ m_resourcesData->addPendingEncodedDataLength(requestId, encodedDataLength);
}
void InspectorNetworkAgent::didFinishLoading(unsigned long identifier,
@@ -760,6 +768,14 @@ void InspectorNetworkAgent::didFinishLoading(unsigned long identifier,
String requestId = IdentifiersFactory::requestId(identifier);
NetworkResourcesData::ResourceData const* resourceData =
m_resourcesData->data(requestId);
+
+ int pendingEncodedDataLength =
+ m_resourcesData->getAndClearPendingEncodedDataLength(requestId);
+ if (pendingEncodedDataLength > 0) {
+ frontend()->dataReceived(requestId, monotonicallyIncreasingTime(), 0,
dgozman 2016/12/06 18:29:31 This is unfortunate, but there is no way around it
+ pendingEncodedDataLength);
+ }
+
if (resourceData &&
(!resourceData->cachedResource() ||
resourceData->cachedResource()->getDataBufferingPolicy() ==

Powered by Google App Engine
This is Rietveld 408576698