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

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: Fix skew in webkit_glue. Created 9 years, 2 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 // 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/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return; 320 return;
321 321
322 request_info->peer->OnUploadProgress(position, size); 322 request_info->peer->OnUploadProgress(position, size);
323 323
324 // Acknowledge receipt 324 // Acknowledge receipt
325 message_sender()->Send( 325 message_sender()->Send(
326 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id)); 326 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id));
327 } 327 }
328 328
329 void ResourceDispatcher::OnReceivedResponse( 329 void ResourceDispatcher::OnReceivedResponse(
330 int request_id, const ResourceResponseHead& response_head) { 330 int request_id, const ResourceResponseHead& response_head,
331 const base::TimeTicks& start_time, const base::TimeTicks& end_time) {
331 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 332 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
332 if (!request_info) 333 if (!request_info)
333 return; 334 return;
334 335
335 if (delegate_) { 336 if (delegate_) {
336 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 337 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
337 delegate_->OnReceivedResponse( 338 delegate_->OnReceivedResponse(
338 request_info->peer, response_head.mime_type, request_info->url); 339 request_info->peer, response_head.mime_type, request_info->url);
339 if (new_peer) 340 if (new_peer)
340 request_info->peer = new_peer; 341 request_info->peer = new_peer;
341 } 342 }
342 343
343 request_info->peer->OnReceivedResponse(response_head); 344 request_info->peer->OnReceivedResponse(response_head, start_time, end_time);
344 } 345 }
345 346
346 void ResourceDispatcher::OnReceivedCachedMetadata( 347 void ResourceDispatcher::OnReceivedCachedMetadata(
347 int request_id, const std::vector<char>& data) { 348 int request_id, const std::vector<char>& data) {
348 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 349 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
349 if (!request_info) 350 if (!request_info)
350 return; 351 return;
351 352
352 if (data.size()) 353 if (data.size())
353 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size()); 354 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (!request_info) 388 if (!request_info)
388 return; 389 return;
389 390
390 request_info->peer->OnDownloadedData(data_len); 391 request_info->peer->OnDownloadedData(data_len);
391 } 392 }
392 393
393 void ResourceDispatcher::OnReceivedRedirect( 394 void ResourceDispatcher::OnReceivedRedirect(
394 const IPC::Message& message, 395 const IPC::Message& message,
395 int request_id, 396 int request_id,
396 const GURL& new_url, 397 const GURL& new_url,
397 const webkit_glue::ResourceResponseInfo& info) { 398 const webkit_glue::ResourceResponseInfo& info,
399 const base::TimeTicks& start_time,
400 const base::TimeTicks& end_time) {
398 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 401 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
399 if (!request_info) 402 if (!request_info)
400 return; 403 return;
401 404
402 int32 routing_id = message.routing_id(); 405 int32 routing_id = message.routing_id();
403 bool has_new_first_party_for_cookies = false; 406 bool has_new_first_party_for_cookies = false;
404 GURL new_first_party_for_cookies; 407 GURL new_first_party_for_cookies;
405 if (request_info->peer->OnReceivedRedirect(new_url, info, 408 if (request_info->peer->OnReceivedRedirect(new_url, info,
406 &has_new_first_party_for_cookies, 409 start_time, end_time,
407 &new_first_party_for_cookies)) { 410 &has_new_first_party_for_cookies,
411 &new_first_party_for_cookies)) {
408 // Double-check if the request is still around. The call above could 412 // Double-check if the request is still around. The call above could
409 // potentially remove it. 413 // potentially remove it.
410 request_info = GetPendingRequestInfo(request_id); 414 request_info = GetPendingRequestInfo(request_id);
411 if (!request_info) 415 if (!request_info)
412 return; 416 return;
413 request_info->pending_redirect_message.reset( 417 request_info->pending_redirect_message.reset(
414 new ResourceHostMsg_FollowRedirect(routing_id, request_id, 418 new ResourceHostMsg_FollowRedirect(routing_id, request_id,
415 has_new_first_party_for_cookies, 419 has_new_first_party_for_cookies,
416 new_first_party_for_cookies)); 420 new_first_party_for_cookies));
417 if (!request_info->is_deferred) { 421 if (!request_info->is_deferred) {
418 FollowPendingRedirect(request_id, *request_info); 422 FollowPendingRedirect(request_id, *request_info);
419 } 423 }
420 } else { 424 } else {
421 CancelPendingRequest(routing_id, request_id); 425 CancelPendingRequest(routing_id, request_id);
422 } 426 }
423 } 427 }
424 428
425 void ResourceDispatcher::FollowPendingRedirect( 429 void ResourceDispatcher::FollowPendingRedirect(
426 int request_id, 430 int request_id,
427 PendingRequestInfo& request_info) { 431 PendingRequestInfo& request_info) {
428 IPC::Message* msg = request_info.pending_redirect_message.release(); 432 IPC::Message* msg = request_info.pending_redirect_message.release();
429 if (msg) 433 if (msg)
430 message_sender()->Send(msg); 434 message_sender()->Send(msg);
431 } 435 }
432 436
433 void ResourceDispatcher::OnRequestComplete(int request_id, 437 void ResourceDispatcher::OnRequestComplete(
434 const net::URLRequestStatus& status, 438 int request_id,
435 const std::string& security_info, 439 const net::URLRequestStatus& status,
436 const base::Time& completion_time) { 440 const std::string& security_info,
441 const base::TimeTicks& completion_time) {
437 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 442 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
438 if (!request_info) 443 if (!request_info)
439 return; 444 return;
440 445
441 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer; 446 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer;
442 447
443 if (delegate_) { 448 if (delegate_) {
444 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 449 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
445 delegate_->OnRequestComplete( 450 delegate_->OnRequestComplete(
446 request_info->peer, request_info->resource_type, status); 451 request_info->peer, request_info->resource_type, status);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 610
606 // static 611 // static
607 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 612 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
608 while (!queue->empty()) { 613 while (!queue->empty()) {
609 IPC::Message* message = queue->front(); 614 IPC::Message* message = queue->front();
610 ReleaseResourcesInDataMessage(*message); 615 ReleaseResourcesInDataMessage(*message);
611 queue->pop_front(); 616 queue->pop_front();
612 delete message; 617 delete message;
613 } 618 }
614 } 619 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698