| 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 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 } | 2853 } |
| 2854 } | 2854 } |
| 2855 | 2855 |
| 2856 // There's nothing to do if there are no local frames in this RenderView's | 2856 // There's nothing to do if there are no local frames in this RenderView's |
| 2857 // frame tree. This can happen if DidFlushPaint is called after the | 2857 // frame tree. This can happen if DidFlushPaint is called after the |
| 2858 // RenderView's local main frame is swapped to a remote frame. See | 2858 // RenderView's local main frame is swapped to a remote frame. See |
| 2859 // http://crbug.com/513552. | 2859 // http://crbug.com/513552. |
| 2860 if (main_frame->isWebRemoteFrame()) | 2860 if (main_frame->isWebRemoteFrame()) |
| 2861 return; | 2861 return; |
| 2862 | 2862 |
| 2863 // If we have a provisional frame we are between the start and commit stages | 2863 WebDataSource* ds = main_frame->dataSource(); |
| 2864 // of loading and we don't want to save stats. | 2864 if (!ds) |
| 2865 if (!main_frame->provisionalDataSource()) { | 2865 return; |
| 2866 WebDataSource* ds = main_frame->dataSource(); | |
| 2867 if (!ds) | |
| 2868 return; | |
| 2869 | 2866 |
| 2870 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2867 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2871 | 2868 |
| 2872 // TODO(jar): The following code should all be inside a method, probably in | 2869 // TODO(jar): The following code should all be inside a method, probably in |
| 2873 // NavigatorState. | 2870 // NavigatorState. |
| 2874 Time now = Time::Now(); | 2871 Time now = Time::Now(); |
| 2875 if (document_state->first_paint_time().is_null()) { | 2872 if (document_state->first_paint_time().is_null()) { |
| 2876 document_state->set_first_paint_time(now); | 2873 document_state->set_first_paint_time(now); |
| 2877 } | 2874 } |
| 2878 if (document_state->first_paint_after_load_time().is_null() && | 2875 if (document_state->first_paint_after_load_time().is_null() && |
| 2879 !document_state->finish_load_time().is_null()) { | 2876 !document_state->finish_load_time().is_null()) { |
| 2880 document_state->set_first_paint_after_load_time(now); | 2877 document_state->set_first_paint_after_load_time(now); |
| 2881 } | |
| 2882 } | 2878 } |
| 2883 } | 2879 } |
| 2884 | 2880 |
| 2885 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 2881 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
| 2886 WebFrame* main_frame = webview()->mainFrame(); | 2882 WebFrame* main_frame = webview()->mainFrame(); |
| 2887 for (WebFrame* frame = main_frame; frame; | 2883 for (WebFrame* frame = main_frame; frame; |
| 2888 frame = frame->traverseNext(false)) { | 2884 frame = frame->traverseNext(false)) { |
| 2889 // TODO(nasko): This is a hack for the case in which the top-level | 2885 // TODO(nasko): This is a hack for the case in which the top-level |
| 2890 // frame is being rendered in another process. It will not | 2886 // frame is being rendered in another process. It will not |
| 2891 // behave correctly for out of process iframes. | 2887 // behave correctly for out of process iframes. |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3692 std::vector<gfx::Size> sizes; | 3688 std::vector<gfx::Size> sizes; |
| 3693 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3689 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3694 if (!url.isEmpty()) | 3690 if (!url.isEmpty()) |
| 3695 urls.push_back( | 3691 urls.push_back( |
| 3696 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3692 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3697 } | 3693 } |
| 3698 SendUpdateFaviconURL(urls); | 3694 SendUpdateFaviconURL(urls); |
| 3699 } | 3695 } |
| 3700 | 3696 |
| 3701 } // namespace content | 3697 } // namespace content |
| OLD | NEW |