OLD | NEW |
---|---|
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 } | 213 } |
214 | 214 |
215 response->error_code = result.error_code; | 215 response->error_code = result.error_code; |
216 response->url = result.final_url; | 216 response->url = result.final_url; |
217 response->headers = result.headers; | 217 response->headers = result.headers; |
218 response->mime_type = result.mime_type; | 218 response->mime_type = result.mime_type; |
219 response->charset = result.charset; | 219 response->charset = result.charset; |
220 response->request_time = result.request_time; | 220 response->request_time = result.request_time; |
221 response->response_time = result.response_time; | 221 response->response_time = result.response_time; |
222 response->encoded_data_length = result.encoded_data_length; | 222 response->encoded_data_length = result.encoded_data_length; |
223 response->connection_id = result.connection_id; | |
224 response->connection_reused = result.connection_reused; | |
225 response->load_timing = result.load_timing; | 223 response->load_timing = result.load_timing; |
226 response->devtools_info = result.devtools_info; | 224 response->devtools_info = result.devtools_info; |
227 response->data.swap(result.data); | 225 response->data.swap(result.data); |
228 response->download_file_path = result.download_file_path; | 226 response->download_file_path = result.download_file_path; |
229 } | 227 } |
230 | 228 |
231 // ResourceDispatcher --------------------------------------------------------- | 229 // ResourceDispatcher --------------------------------------------------------- |
232 | 230 |
233 ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender) | 231 ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender) |
234 : message_sender_(sender), | 232 : message_sender_(sender), |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 | 619 |
622 void ResourceDispatcher::ToResourceResponseInfo( | 620 void ResourceDispatcher::ToResourceResponseInfo( |
623 const PendingRequestInfo& request_info, | 621 const PendingRequestInfo& request_info, |
624 const ResourceResponseHead& browser_info, | 622 const ResourceResponseHead& browser_info, |
625 ResourceResponseInfo* renderer_info) const { | 623 ResourceResponseInfo* renderer_info) const { |
626 *renderer_info = browser_info; | 624 *renderer_info = browser_info; |
627 if (request_info.request_start.is_null() || | 625 if (request_info.request_start.is_null() || |
628 request_info.response_start.is_null() || | 626 request_info.response_start.is_null() || |
629 browser_info.request_start.is_null() || | 627 browser_info.request_start.is_null() || |
630 browser_info.response_start.is_null() || | 628 browser_info.response_start.is_null() || |
631 browser_info.load_timing.base_ticks.is_null()) { | 629 browser_info.load_timing.request_start.is_null()) { |
632 return; | 630 return; |
633 } | 631 } |
634 InterProcessTimeTicksConverter converter( | 632 InterProcessTimeTicksConverter converter( |
eroman
2013/02/13 02:07:20
Interesting, I didn't even realize this was a prob
mmenke
2013/02/13 02:26:46
That would be handy.
| |
635 LocalTimeTicks::FromTimeTicks(request_info.request_start), | 633 LocalTimeTicks::FromTimeTicks(request_info.request_start), |
636 LocalTimeTicks::FromTimeTicks(request_info.response_start), | 634 LocalTimeTicks::FromTimeTicks(request_info.response_start), |
637 RemoteTimeTicks::FromTimeTicks(browser_info.request_start), | 635 RemoteTimeTicks::FromTimeTicks(browser_info.request_start), |
638 RemoteTimeTicks::FromTimeTicks(browser_info.response_start)); | 636 RemoteTimeTicks::FromTimeTicks(browser_info.response_start)); |
639 | 637 |
640 LocalTimeTicks renderer_base_ticks = converter.ToLocalTimeTicks( | 638 #define CONVERT(field) \ |
641 RemoteTimeTicks::FromTimeTicks(browser_info.load_timing.base_ticks)); | 639 renderer_info->load_timing.field = converter.ToLocalTimeTicks( \ |
642 renderer_info->load_timing.base_ticks = renderer_base_ticks.ToTimeTicks(); | 640 RemoteTimeTicks::FromTimeTicks( \ |
641 browser_info.load_timing.field)).ToTimeTicks() | |
643 | 642 |
644 #define CONVERT(field) \ | 643 CONVERT(request_start); |
645 LocalTimeDelta renderer_##field = converter.ToLocalTimeDelta( \ | 644 CONVERT(proxy_resolve_start); |
646 RemoteTimeDelta::FromRawDelta(browser_info.load_timing.field)); \ | 645 CONVERT(proxy_resolve_end); |
647 renderer_info->load_timing.field = renderer_##field.ToInt32() | 646 CONVERT(connect_timing.dns_start); |
648 | 647 CONVERT(connect_timing.dns_end); |
649 CONVERT(proxy_start); | 648 CONVERT(connect_timing.connect_start); |
650 CONVERT(dns_start); | 649 CONVERT(connect_timing.connect_end); |
651 CONVERT(dns_end); | 650 CONVERT(connect_timing.ssl_start); |
652 CONVERT(connect_start); | 651 CONVERT(connect_timing.ssl_end); |
653 CONVERT(connect_end); | |
654 CONVERT(ssl_start); | |
655 CONVERT(ssl_end); | |
656 CONVERT(send_start); | 652 CONVERT(send_start); |
657 CONVERT(send_end); | 653 CONVERT(send_end); |
658 CONVERT(receive_headers_start); | |
659 CONVERT(receive_headers_end); | 654 CONVERT(receive_headers_end); |
660 | 655 |
661 #undef CONVERT | 656 #undef CONVERT |
662 } | 657 } |
663 | 658 |
664 base::TimeTicks ResourceDispatcher::ToRendererCompletionTime( | 659 base::TimeTicks ResourceDispatcher::ToRendererCompletionTime( |
665 const PendingRequestInfo& request_info, | 660 const PendingRequestInfo& request_info, |
666 const base::TimeTicks& browser_completion_time) const { | 661 const base::TimeTicks& browser_completion_time) const { |
667 if (request_info.completion_time.is_null()) { | 662 if (request_info.completion_time.is_null()) { |
668 return browser_completion_time; | 663 return browser_completion_time; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 721 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
727 while (!queue->empty()) { | 722 while (!queue->empty()) { |
728 IPC::Message* message = queue->front(); | 723 IPC::Message* message = queue->front(); |
729 ReleaseResourcesInDataMessage(*message); | 724 ReleaseResourcesInDataMessage(*message); |
730 queue->pop_front(); | 725 queue->pop_front(); |
731 delete message; | 726 delete message; |
732 } | 727 } |
733 } | 728 } |
734 | 729 |
735 } // namespace content | 730 } // namespace content |
OLD | NEW |