OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
879 const char* data = NULL; | 879 const char* data = NULL; |
880 if (params.browser_initiated_post_data.size()) { | 880 if (params.browser_initiated_post_data.size()) { |
881 data = reinterpret_cast<const char*>( | 881 data = reinterpret_cast<const char*>( |
882 ¶ms.browser_initiated_post_data.front()); | 882 ¶ms.browser_initiated_post_data.front()); |
883 } | 883 } |
884 http_body.appendData( | 884 http_body.appendData( |
885 WebData(data, params.browser_initiated_post_data.size())); | 885 WebData(data, params.browser_initiated_post_data.size())); |
886 request.setHTTPBody(http_body); | 886 request.setHTTPBody(http_body); |
887 } | 887 } |
888 | 888 |
889 // Record this before starting the load, we need a lower bound of this time | |
890 // to sanitize the navigationStart override set below. | |
891 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); | |
889 frame->loadRequest(request); | 892 frame->loadRequest(request); |
890 | 893 |
891 // The browser provides the navigation_start time to bootstrap the | 894 // The browser provides the navigation_start time to bootstrap the |
892 // Navigation Timing information for the browser-initiated navigations. In | 895 // Navigation Timing information for the browser-initiated navigations. In |
893 // case of cross-process navigations, this carries over the time of | 896 // case of cross-process navigations, this carries over the time of |
894 // finishing the onbeforeunload handler of the previous page. | 897 // finishing the onbeforeunload handler of the previous page. |
895 DCHECK(!params.browser_navigation_start.is_null()); | 898 DCHECK(!params.browser_navigation_start.is_null()); |
896 if (frame->provisionalDataSource()) { | 899 if (frame->provisionalDataSource()) { |
897 // browser_navigation_start is likely before this process existed, so we | 900 // |browser_navigation_start| is likely before this process existed, so we |
898 // can't use InterProcessTimeTicksConverter. Instead, the best we can do | 901 // can't use InterProcessTimeTicksConverter. We need at least to ensure |
899 // is just ensure we don't report a bogus value in the future. | 902 // that the browser-side navigation start we set is not later than the one |
903 // on the renderer side. | |
900 base::TimeTicks navigation_start = std::min( | 904 base::TimeTicks navigation_start = std::min( |
pasko
2014/07/17 13:18:00
This min() could be a reason of bi-modal distribut
ppi
2014/07/17 13:27:43
This is an excellent idea, also solving the proble
| |
901 base::TimeTicks::Now(), params.browser_navigation_start); | 905 params.browser_navigation_start, renderer_navigation_start); |
902 double navigation_start_seconds = | 906 double navigation_start_seconds = |
903 (navigation_start - base::TimeTicks()).InSecondsF(); | 907 (navigation_start - base::TimeTicks()).InSecondsF(); |
904 frame->provisionalDataSource()->setNavigationStartTime( | 908 frame->provisionalDataSource()->setNavigationStartTime( |
905 navigation_start_seconds); | 909 navigation_start_seconds); |
906 } | 910 } |
907 } | 911 } |
908 | 912 |
909 // In case LoadRequest failed before DidCreateDataSource was called. | 913 // In case LoadRequest failed before DidCreateDataSource was called. |
910 render_view_->pending_navigation_params_.reset(); | 914 render_view_->pending_navigation_params_.reset(); |
911 } | 915 } |
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3578 | 3582 |
3579 #if defined(ENABLE_BROWSER_CDMS) | 3583 #if defined(ENABLE_BROWSER_CDMS) |
3580 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3584 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3581 if (!cdm_manager_) | 3585 if (!cdm_manager_) |
3582 cdm_manager_ = new RendererCdmManager(this); | 3586 cdm_manager_ = new RendererCdmManager(this); |
3583 return cdm_manager_; | 3587 return cdm_manager_; |
3584 } | 3588 } |
3585 #endif // defined(ENABLE_BROWSER_CDMS) | 3589 #endif // defined(ENABLE_BROWSER_CDMS) |
3586 | 3590 |
3587 } // namespace content | 3591 } // namespace content |
OLD | NEW |