| 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 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 | 2179 |
| 2180 message->EnableMessagePumping(); // Runs a nested message loop. | 2180 message->EnableMessagePumping(); // Runs a nested message loop. |
| 2181 return Send(message); | 2181 return Send(message); |
| 2182 } | 2182 } |
| 2183 | 2183 |
| 2184 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { | 2184 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
| 2185 int id = next_snapshot_id_++; | 2185 int id = next_snapshot_id_++; |
| 2186 pending_snapshots_.insert(std::make_pair(id, callback)); | 2186 pending_snapshots_.insert(std::make_pair(id, callback)); |
| 2187 ui::LatencyInfo latency_info; | 2187 ui::LatencyInfo latency_info; |
| 2188 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2188 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
| 2189 GetLatencyComponentId(), | 2189 0, |
| 2190 id); | 2190 id); |
| 2191 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; | 2191 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; |
| 2192 if (RenderWidgetCompositor* rwc = compositor()) { | 2192 if (RenderWidgetCompositor* rwc = compositor()) { |
| 2193 latency_info_swap_promise_monitor = | 2193 latency_info_swap_promise_monitor = |
| 2194 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass(); | 2194 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass(); |
| 2195 } else { | 2195 } else { |
| 2196 latency_info_.push_back(latency_info); | 2196 latency_info_.push_back(latency_info); |
| 2197 } | 2197 } |
| 2198 ScheduleCompositeWithForcedRedraw(); | 2198 ScheduleCompositeWithForcedRedraw(); |
| 2199 } | 2199 } |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2749 } | 2749 } |
| 2750 } | 2750 } |
| 2751 | 2751 |
| 2752 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( | 2752 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( |
| 2753 const gfx::RectF& rect) const { | 2753 const gfx::RectF& rect) const { |
| 2754 gfx::RectF window_rect = rect; | 2754 gfx::RectF window_rect = rect; |
| 2755 window_rect.Scale(device_scale_factor_ * webview()->pageScaleFactor()); | 2755 window_rect.Scale(device_scale_factor_ * webview()->pageScaleFactor()); |
| 2756 return window_rect; | 2756 return window_rect; |
| 2757 } | 2757 } |
| 2758 | 2758 |
| 2759 int64 RenderViewImpl::GetLatencyComponentId() { | |
| 2760 // Note: this must match the logic in RenderWidgetHostImpl. | |
| 2761 return GetRoutingID() | (static_cast<int64>( | |
| 2762 RenderThreadImpl::current()->renderer_process_id()) << 32); | |
| 2763 } | |
| 2764 | |
| 2765 void RenderViewImpl::StartNavStateSyncTimerIfNecessary() { | 2759 void RenderViewImpl::StartNavStateSyncTimerIfNecessary() { |
| 2766 // No need to update state if no page has committed yet. | 2760 // No need to update state if no page has committed yet. |
| 2767 if (page_id_ == -1) | 2761 if (page_id_ == -1) |
| 2768 return; | 2762 return; |
| 2769 | 2763 |
| 2770 int delay; | 2764 int delay; |
| 2771 if (send_content_state_immediately_) | 2765 if (send_content_state_immediately_) |
| 2772 delay = 0; | 2766 delay = 0; |
| 2773 else if (is_hidden()) | 2767 else if (is_hidden()) |
| 2774 delay = kDelaySecondsForContentStateSyncHidden; | 2768 delay = kDelaySecondsForContentStateSyncHidden; |
| (...skipping 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6259 for (size_t i = 0; i < icon_urls.size(); i++) { | 6253 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6260 WebURL url = icon_urls[i].iconURL(); | 6254 WebURL url = icon_urls[i].iconURL(); |
| 6261 if (!url.isEmpty()) | 6255 if (!url.isEmpty()) |
| 6262 urls.push_back(FaviconURL(url, | 6256 urls.push_back(FaviconURL(url, |
| 6263 ToFaviconType(icon_urls[i].iconType()))); | 6257 ToFaviconType(icon_urls[i].iconType()))); |
| 6264 } | 6258 } |
| 6265 SendUpdateFaviconURL(urls); | 6259 SendUpdateFaviconURL(urls); |
| 6266 } | 6260 } |
| 6267 | 6261 |
| 6268 } // namespace content | 6262 } // namespace content |
| OLD | NEW |