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

Side by Side Diff: Source/core/inspector/InspectorResourceAgent.cpp

Issue 156623005: Add transfer size paramater to didFinishLoading [3/3] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } else { 242 } else {
243 status = response.httpStatusCode(); 243 status = response.httpStatusCode();
244 statusText = response.httpStatusText(); 244 statusText = response.httpStatusText();
245 } 245 }
246 RefPtr<JSONObject> headers; 246 RefPtr<JSONObject> headers;
247 if (response.resourceLoadInfo()) 247 if (response.resourceLoadInfo())
248 headers = buildObjectForHeaders(response.resourceLoadInfo()->responseHea ders); 248 headers = buildObjectForHeaders(response.resourceLoadInfo()->responseHea ders);
249 else 249 else
250 headers = buildObjectForHeaders(response.httpHeaderFields()); 250 headers = buildObjectForHeaders(response.httpHeaderFields());
251 251
252 int64_t encodedDataLength = response.resourceLoadInfo() ? response.resourceL oadInfo()->encodedDataLength : -1;
253
252 RefPtr<TypeBuilder::Network::Response> responseObject = TypeBuilder::Network ::Response::create() 254 RefPtr<TypeBuilder::Network::Response> responseObject = TypeBuilder::Network ::Response::create()
253 .setUrl(urlWithoutFragment(response.url()).string()) 255 .setUrl(urlWithoutFragment(response.url()).string())
254 .setStatus(status) 256 .setStatus(status)
255 .setStatusText(statusText) 257 .setStatusText(statusText)
256 .setHeaders(headers) 258 .setHeaders(headers)
257 .setMimeType(response.mimeType()) 259 .setMimeType(response.mimeType())
258 .setConnectionReused(response.connectionReused()) 260 .setConnectionReused(response.connectionReused())
259 .setConnectionId(response.connectionID()); 261 .setConnectionId(response.connectionID())
262 .setEncodedDataLength(encodedDataLength);
260 263
261 responseObject->setFromDiskCache(response.wasCached()); 264 responseObject->setFromDiskCache(response.wasCached());
262 if (response.resourceLoadTiming()) 265 if (response.resourceLoadTiming())
263 responseObject->setTiming(buildObjectForTiming(*response.resourceLoadTim ing(), loader)); 266 responseObject->setTiming(buildObjectForTiming(*response.resourceLoadTim ing(), loader));
264 267
265 if (response.resourceLoadInfo()) { 268 if (response.resourceLoadInfo()) {
266 if (!response.resourceLoadInfo()->responseHeadersText.isEmpty()) 269 if (!response.resourceLoadInfo()->responseHeadersText.isEmpty())
267 responseObject->setHeadersText(response.resourceLoadInfo()->response HeadersText); 270 responseObject->setHeadersText(response.resourceLoadInfo()->response HeadersText);
268 271
269 responseObject->setRequestHeaders(buildObjectForHeaders(response.resourc eLoadInfo()->requestHeaders)); 272 responseObject->setRequestHeaders(buildObjectForHeaders(response.resourc eLoadInfo()->requestHeaders));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 388
386 if (data) { 389 if (data) {
387 NetworkResourcesData::ResourceData const* resourceData = m_resourcesData ->data(requestId); 390 NetworkResourcesData::ResourceData const* resourceData = m_resourcesData ->data(requestId);
388 if (resourceData && (!resourceData->cachedResource() || resourceData->ca chedResource()->dataBufferingPolicy() == DoNotBufferData || isErrorStatusCode(re sourceData->httpStatusCode()))) 391 if (resourceData && (!resourceData->cachedResource() || resourceData->ca chedResource()->dataBufferingPolicy() == DoNotBufferData || isErrorStatusCode(re sourceData->httpStatusCode())))
389 m_resourcesData->maybeAddResourceData(requestId, data, dataLength); 392 m_resourcesData->maybeAddResourceData(requestId, data, dataLength);
390 } 393 }
391 394
392 m_frontend->dataReceived(requestId, currentTime(), dataLength, encodedDataLe ngth); 395 m_frontend->dataReceived(requestId, currentTime(), dataLength, encodedDataLe ngth);
393 } 396 }
394 397
395 void InspectorResourceAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime) 398 void InspectorResourceAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime, int64_t encodedDataLength)
396 { 399 {
397 double finishTime = 0.0; 400 double finishTime = 0.0;
398 // FIXME: Expose all of the timing details to inspector and have it calculat e finishTime. 401 // FIXME: Expose all of the timing details to inspector and have it calculat e finishTime.
399 if (monotonicFinishTime) 402 if (monotonicFinishTime)
400 finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFi nishTime); 403 finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFi nishTime);
401 404
402 String requestId = IdentifiersFactory::requestId(identifier); 405 String requestId = IdentifiersFactory::requestId(identifier);
403 m_resourcesData->maybeDecodeDataToContent(requestId); 406 m_resourcesData->maybeDecodeDataToContent(requestId);
404 if (!finishTime) 407 if (!finishTime)
405 finishTime = currentTime(); 408 finishTime = currentTime();
406 m_frontend->loadingFinished(requestId, finishTime); 409 m_frontend->loadingFinished(requestId, finishTime, encodedDataLength);
407 } 410 }
408 411
409 void InspectorResourceAgent::didReceiveCORSRedirectResponse(Frame* frame, unsign ed long identifier, DocumentLoader* loader, const ResourceResponse& response, Re sourceLoader* resourceLoader) 412 void InspectorResourceAgent::didReceiveCORSRedirectResponse(Frame* frame, unsign ed long identifier, DocumentLoader* loader, const ResourceResponse& response, Re sourceLoader* resourceLoader)
410 { 413 {
411 // Update the response and finish loading 414 // Update the response and finish loading
412 didReceiveResourceResponse(frame, identifier, loader, response, resourceLoad er); 415 didReceiveResourceResponse(frame, identifier, loader, response, resourceLoad er);
413 didFinishLoading(identifier, loader, 0); 416 didFinishLoading(identifier, loader, 0, blink::WebURLLoaderClient::kUnknownE ncodedDataLength);
414 } 417 }
415 418
416 void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLo ader* loader, const ResourceError& error) 419 void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLo ader* loader, const ResourceError& error)
417 { 420 {
418 String requestId = IdentifiersFactory::requestId(identifier); 421 String requestId = IdentifiersFactory::requestId(identifier);
419 bool canceled = error.isCancellation(); 422 bool canceled = error.isCancellation();
420 m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescripti on(), canceled ? &canceled : 0); 423 m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescripti on(), canceled ? &canceled : 0);
421 } 424 }
422 425
423 void InspectorResourceAgent::scriptImported(unsigned long identifier, const Stri ng& sourceString) 426 void InspectorResourceAgent::scriptImported(unsigned long identifier, const Stri ng& sourceString)
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 : InspectorBaseAgent<InspectorResourceAgent>("Network") 799 : InspectorBaseAgent<InspectorResourceAgent>("Network")
797 , m_pageAgent(pageAgent) 800 , m_pageAgent(pageAgent)
798 , m_client(client) 801 , m_client(client)
799 , m_frontend(0) 802 , m_frontend(0)
800 , m_resourcesData(adoptPtr(new NetworkResourcesData())) 803 , m_resourcesData(adoptPtr(new NetworkResourcesData()))
801 , m_isRecalculatingStyle(false) 804 , m_isRecalculatingStyle(false)
802 { 805 {
803 } 806 }
804 807
805 } // namespace WebCore 808 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698