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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 | 2174 |
2175 message->EnableMessagePumping(); // Runs a nested message loop. | 2175 message->EnableMessagePumping(); // Runs a nested message loop. |
2176 return Send(message); | 2176 return Send(message); |
2177 } | 2177 } |
2178 | 2178 |
2179 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { | 2179 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
2180 int id = next_snapshot_id_++; | 2180 int id = next_snapshot_id_++; |
2181 pending_snapshots_.insert(std::make_pair(id, callback)); | 2181 pending_snapshots_.insert(std::make_pair(id, callback)); |
2182 ui::LatencyInfo latency_info; | 2182 ui::LatencyInfo latency_info; |
2183 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2183 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2184 GetLatencyComponentId(), | 2184 0, |
2185 id); | 2185 id); |
2186 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; | 2186 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; |
2187 if (RenderWidgetCompositor* rwc = compositor()) { | 2187 if (RenderWidgetCompositor* rwc = compositor()) { |
2188 latency_info_swap_promise_monitor = | 2188 latency_info_swap_promise_monitor = |
2189 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass(); | 2189 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass(); |
2190 } else { | 2190 } else { |
2191 latency_info_.push_back(latency_info); | 2191 latency_info_.push_back(latency_info); |
2192 } | 2192 } |
2193 ScheduleCompositeWithForcedRedraw(); | 2193 ScheduleCompositeWithForcedRedraw(); |
2194 } | 2194 } |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2744 } | 2744 } |
2745 } | 2745 } |
2746 | 2746 |
2747 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( | 2747 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( |
2748 const gfx::RectF& rect) const { | 2748 const gfx::RectF& rect) const { |
2749 gfx::RectF window_rect = rect; | 2749 gfx::RectF window_rect = rect; |
2750 window_rect.Scale(device_scale_factor_ * webview()->pageScaleFactor()); | 2750 window_rect.Scale(device_scale_factor_ * webview()->pageScaleFactor()); |
2751 return window_rect; | 2751 return window_rect; |
2752 } | 2752 } |
2753 | 2753 |
2754 int64 RenderViewImpl::GetLatencyComponentId() { | |
2755 // Note: this must match the logic in RenderWidgetHostImpl. | |
2756 return GetRoutingID() | (static_cast<int64>( | |
2757 RenderThreadImpl::current()->renderer_process_id()) << 32); | |
2758 } | |
2759 | |
2760 void RenderViewImpl::StartNavStateSyncTimerIfNecessary() { | 2754 void RenderViewImpl::StartNavStateSyncTimerIfNecessary() { |
2761 // No need to update state if no page has committed yet. | 2755 // No need to update state if no page has committed yet. |
2762 if (page_id_ == -1) | 2756 if (page_id_ == -1) |
2763 return; | 2757 return; |
2764 | 2758 |
2765 int delay; | 2759 int delay; |
2766 if (send_content_state_immediately_) | 2760 if (send_content_state_immediately_) |
2767 delay = 0; | 2761 delay = 0; |
2768 else if (is_hidden()) | 2762 else if (is_hidden()) |
2769 delay = kDelaySecondsForContentStateSyncHidden; | 2763 delay = kDelaySecondsForContentStateSyncHidden; |
(...skipping 3463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6233 for (size_t i = 0; i < icon_urls.size(); i++) { | 6227 for (size_t i = 0; i < icon_urls.size(); i++) { |
6234 WebURL url = icon_urls[i].iconURL(); | 6228 WebURL url = icon_urls[i].iconURL(); |
6235 if (!url.isEmpty()) | 6229 if (!url.isEmpty()) |
6236 urls.push_back(FaviconURL(url, | 6230 urls.push_back(FaviconURL(url, |
6237 ToFaviconType(icon_urls[i].iconType()))); | 6231 ToFaviconType(icon_urls[i].iconType()))); |
6238 } | 6232 } |
6239 SendUpdateFaviconURL(urls); | 6233 SendUpdateFaviconURL(urls); |
6240 } | 6234 } |
6241 | 6235 |
6242 } // namespace content | 6236 } // namespace content |
OLD | NEW |