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

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

Issue 12094085: LoadTiming in net part 7: Hooking it all up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 response->error_code = result.error_code; 227 response->error_code = result.error_code;
228 response->url = result.final_url; 228 response->url = result.final_url;
229 response->headers = result.headers; 229 response->headers = result.headers;
230 response->mime_type = result.mime_type; 230 response->mime_type = result.mime_type;
231 response->charset = result.charset; 231 response->charset = result.charset;
232 response->request_time = result.request_time; 232 response->request_time = result.request_time;
233 response->response_time = result.response_time; 233 response->response_time = result.response_time;
234 response->encoded_data_length = result.encoded_data_length; 234 response->encoded_data_length = result.encoded_data_length;
235 response->connection_id = result.connection_id;
236 response->connection_reused = result.connection_reused;
237 response->load_timing = result.load_timing; 235 response->load_timing = result.load_timing;
238 response->devtools_info = result.devtools_info; 236 response->devtools_info = result.devtools_info;
239 response->data.swap(result.data); 237 response->data.swap(result.data);
240 response->download_file_path = result.download_file_path; 238 response->download_file_path = result.download_file_path;
241 } 239 }
242 240
243 // ResourceDispatcher --------------------------------------------------------- 241 // ResourceDispatcher ---------------------------------------------------------
244 242
245 ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender) 243 ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender)
246 : message_sender_(sender), 244 : message_sender_(sender),
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 638
641 void ResourceDispatcher::ToResourceResponseInfo( 639 void ResourceDispatcher::ToResourceResponseInfo(
642 const PendingRequestInfo& request_info, 640 const PendingRequestInfo& request_info,
643 const ResourceResponseHead& browser_info, 641 const ResourceResponseHead& browser_info,
644 ResourceResponseInfo* renderer_info) const { 642 ResourceResponseInfo* renderer_info) const {
645 *renderer_info = browser_info; 643 *renderer_info = browser_info;
646 if (request_info.request_start.is_null() || 644 if (request_info.request_start.is_null() ||
647 request_info.response_start.is_null() || 645 request_info.response_start.is_null() ||
648 browser_info.request_start.is_null() || 646 browser_info.request_start.is_null() ||
649 browser_info.response_start.is_null() || 647 browser_info.response_start.is_null() ||
650 browser_info.load_timing.base_ticks.is_null()) { 648 browser_info.load_timing.request_start.is_null()) {
651 return; 649 return;
652 } 650 }
653 InterProcessTimeTicksConverter converter( 651 InterProcessTimeTicksConverter converter(
654 LocalTimeTicks::FromTimeTicks(request_info.request_start), 652 LocalTimeTicks::FromTimeTicks(request_info.request_start),
655 LocalTimeTicks::FromTimeTicks(request_info.response_start), 653 LocalTimeTicks::FromTimeTicks(request_info.response_start),
656 RemoteTimeTicks::FromTimeTicks(browser_info.request_start), 654 RemoteTimeTicks::FromTimeTicks(browser_info.request_start),
657 RemoteTimeTicks::FromTimeTicks(browser_info.response_start)); 655 RemoteTimeTicks::FromTimeTicks(browser_info.response_start));
658 656
659 LocalTimeTicks renderer_base_ticks = converter.ToLocalTimeTicks( 657 #define CONVERT(field) \
660 RemoteTimeTicks::FromTimeTicks(browser_info.load_timing.base_ticks)); 658 renderer_info->load_timing.field = converter.ToLocalTimeTicks( \
darin (slow to review) 2013/02/28 16:57:35 nit: it seems like you could save some generated c
mmenke 2013/02/28 17:36:55 Done. I assume this ugliness is deliberate, to em
661 renderer_info->load_timing.base_ticks = renderer_base_ticks.ToTimeTicks(); 659 RemoteTimeTicks::FromTimeTicks( \
660 browser_info.load_timing.field)).ToTimeTicks()
662 661
663 #define CONVERT(field) \ 662 CONVERT(request_start);
664 LocalTimeDelta renderer_##field = converter.ToLocalTimeDelta( \ 663 CONVERT(proxy_resolve_start);
665 RemoteTimeDelta::FromRawDelta(browser_info.load_timing.field)); \ 664 CONVERT(proxy_resolve_end);
666 renderer_info->load_timing.field = renderer_##field.ToInt32() 665 CONVERT(connect_timing.dns_start);
667 666 CONVERT(connect_timing.dns_end);
668 CONVERT(proxy_start); 667 CONVERT(connect_timing.connect_start);
669 CONVERT(dns_start); 668 CONVERT(connect_timing.connect_end);
670 CONVERT(dns_end); 669 CONVERT(connect_timing.ssl_start);
671 CONVERT(connect_start); 670 CONVERT(connect_timing.ssl_end);
672 CONVERT(connect_end);
673 CONVERT(ssl_start);
674 CONVERT(ssl_end);
675 CONVERT(send_start); 671 CONVERT(send_start);
676 CONVERT(send_end); 672 CONVERT(send_end);
677 CONVERT(receive_headers_start);
678 CONVERT(receive_headers_end); 673 CONVERT(receive_headers_end);
679 674
680 #undef CONVERT 675 #undef CONVERT
681 } 676 }
682 677
683 base::TimeTicks ResourceDispatcher::ToRendererCompletionTime( 678 base::TimeTicks ResourceDispatcher::ToRendererCompletionTime(
684 const PendingRequestInfo& request_info, 679 const PendingRequestInfo& request_info,
685 const base::TimeTicks& browser_completion_time) const { 680 const base::TimeTicks& browser_completion_time) const {
686 if (request_info.completion_time.is_null()) { 681 if (request_info.completion_time.is_null()) {
687 return browser_completion_time; 682 return browser_completion_time;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 740 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
746 while (!queue->empty()) { 741 while (!queue->empty()) {
747 IPC::Message* message = queue->front(); 742 IPC::Message* message = queue->front();
748 ReleaseResourcesInDataMessage(*message); 743 ReleaseResourcesInDataMessage(*message);
749 queue->pop_front(); 744 queue->pop_front();
750 delete message; 745 delete message;
751 } 746 }
752 } 747 }
753 748
754 } // namespace content 749 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698