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

Side by Side Diff: content/common/resource_dispatcher.cc

Issue 7602023: Use a monotonic clock (TimeTicks) to report network times to WebCore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use strong typing 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/common/resource_dispatcher.h" 7 #include "content/common/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return; 325 return;
326 326
327 request_info->peer->OnUploadProgress(position, size); 327 request_info->peer->OnUploadProgress(position, size);
328 328
329 // Acknowledge receipt 329 // Acknowledge receipt
330 message_sender()->Send( 330 message_sender()->Send(
331 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id)); 331 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id));
332 } 332 }
333 333
334 void ResourceDispatcher::OnReceivedResponse( 334 void ResourceDispatcher::OnReceivedResponse(
335 int request_id, const ResourceResponseHead& response_head) { 335 int request_id, const ResourceResponseHead& response_head,
336 const base::TimeTicks& start_time, const base::TimeTicks& end_time) {
336 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 337 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
337 if (!request_info) 338 if (!request_info)
338 return; 339 return;
339 340
340 if (delegate_) { 341 if (delegate_) {
341 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 342 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
342 delegate_->OnReceivedResponse( 343 delegate_->OnReceivedResponse(
343 request_info->peer, response_head.mime_type, request_info->url); 344 request_info->peer, response_head.mime_type, request_info->url);
344 if (new_peer) 345 if (new_peer)
345 request_info->peer = new_peer; 346 request_info->peer = new_peer;
346 } 347 }
347 348
348 request_info->peer->OnReceivedResponse(response_head); 349 request_info->peer->OnReceivedResponse(response_head, start_time, end_time);
349 } 350 }
350 351
351 void ResourceDispatcher::OnReceivedCachedMetadata( 352 void ResourceDispatcher::OnReceivedCachedMetadata(
352 int request_id, const std::vector<char>& data) { 353 int request_id, const std::vector<char>& data) {
353 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 354 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
354 if (!request_info) 355 if (!request_info)
355 return; 356 return;
356 357
357 if (data.size()) 358 if (data.size())
358 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size()); 359 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 if (!request_info) 393 if (!request_info)
393 return; 394 return;
394 395
395 request_info->peer->OnDownloadedData(data_len); 396 request_info->peer->OnDownloadedData(data_len);
396 } 397 }
397 398
398 void ResourceDispatcher::OnReceivedRedirect( 399 void ResourceDispatcher::OnReceivedRedirect(
399 const IPC::Message& message, 400 const IPC::Message& message,
400 int request_id, 401 int request_id,
401 const GURL& new_url, 402 const GURL& new_url,
402 const webkit_glue::ResourceResponseInfo& info) { 403 const webkit_glue::ResourceResponseInfo& info,
404 const base::TimeTicks& start_time,
405 const base::TimeTicks& end_time) {
403 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 406 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
404 if (!request_info) 407 if (!request_info)
405 return; 408 return;
406 409
407 int32 routing_id = message.routing_id(); 410 int32 routing_id = message.routing_id();
408 bool has_new_first_party_for_cookies = false; 411 bool has_new_first_party_for_cookies = false;
409 GURL new_first_party_for_cookies; 412 GURL new_first_party_for_cookies;
410 if (request_info->peer->OnReceivedRedirect(new_url, info, 413 if (request_info->peer->OnReceivedRedirect(new_url, info,
411 &has_new_first_party_for_cookies, 414 start_time, end_time,
412 &new_first_party_for_cookies)) { 415 &has_new_first_party_for_cookies,
416 &new_first_party_for_cookies)) {
413 // Double-check if the request is still around. The call above could 417 // Double-check if the request is still around. The call above could
414 // potentially remove it. 418 // potentially remove it.
415 request_info = GetPendingRequestInfo(request_id); 419 request_info = GetPendingRequestInfo(request_id);
416 if (!request_info) 420 if (!request_info)
417 return; 421 return;
418 request_info->pending_redirect_message.reset( 422 request_info->pending_redirect_message.reset(
419 new ResourceHostMsg_FollowRedirect(routing_id, request_id, 423 new ResourceHostMsg_FollowRedirect(routing_id, request_id,
420 has_new_first_party_for_cookies, 424 has_new_first_party_for_cookies,
421 new_first_party_for_cookies)); 425 new_first_party_for_cookies));
422 if (!request_info->is_deferred) { 426 if (!request_info->is_deferred) {
423 FollowPendingRedirect(request_id, *request_info); 427 FollowPendingRedirect(request_id, *request_info);
424 } 428 }
425 } else { 429 } else {
426 CancelPendingRequest(routing_id, request_id); 430 CancelPendingRequest(routing_id, request_id);
427 } 431 }
428 } 432 }
429 433
430 void ResourceDispatcher::FollowPendingRedirect( 434 void ResourceDispatcher::FollowPendingRedirect(
431 int request_id, 435 int request_id,
432 PendingRequestInfo& request_info) { 436 PendingRequestInfo& request_info) {
433 IPC::Message* msg = request_info.pending_redirect_message.release(); 437 IPC::Message* msg = request_info.pending_redirect_message.release();
434 if (msg) 438 if (msg)
435 message_sender()->Send(msg); 439 message_sender()->Send(msg);
436 } 440 }
437 441
438 void ResourceDispatcher::OnRequestComplete(int request_id, 442 void ResourceDispatcher::OnRequestComplete(
439 const net::URLRequestStatus& status, 443 int request_id,
440 const std::string& security_info, 444 const net::URLRequestStatus& status,
441 const base::Time& completion_time) { 445 const std::string& security_info,
446 const base::TimeTicks& completion_time) {
442 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 447 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
443 if (!request_info) 448 if (!request_info)
444 return; 449 return;
445 450
446 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer; 451 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer;
447 452
448 if (delegate_) { 453 if (delegate_) {
449 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 454 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
450 delegate_->OnRequestComplete( 455 delegate_->OnRequestComplete(
451 request_info->peer, request_info->resource_type, status); 456 request_info->peer, request_info->resource_type, status);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 615
611 // static 616 // static
612 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 617 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
613 while (!queue->empty()) { 618 while (!queue->empty()) {
614 IPC::Message* message = queue->front(); 619 IPC::Message* message = queue->front();
615 ReleaseResourcesInDataMessage(*message); 620 ReleaseResourcesInDataMessage(*message);
616 queue->pop_front(); 621 queue->pop_front();
617 delete message; 622 delete message;
618 } 623 }
619 } 624 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698