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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2063 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2064 GetLatencyComponentId(), | 2064 GetLatencyComponentId(), |
2065 &window_snapshot_component)) { | 2065 &window_snapshot_component)) { |
2066 int sequence_number = static_cast<int>( | 2066 int sequence_number = static_cast<int>( |
2067 window_snapshot_component.sequence_number); | 2067 window_snapshot_component.sequence_number); |
2068 #if defined(OS_MACOSX) | 2068 #if defined(OS_MACOSX) |
2069 // On Mac, when using CoreAnmation, there is a delay between when content | 2069 // On Mac, when using CoreAnmation, there is a delay between when content |
2070 // is drawn to the screen, and when the snapshot will actually pick up | 2070 // is drawn to the screen, and when the snapshot will actually pick up |
2071 // that content. Insert a manual delay of 1/6th of a second (to simulate | 2071 // that content. Insert a manual delay of 1/6th of a second (to simulate |
2072 // 10 frames at 60 fps) before actually taking the snapshot. | 2072 // 10 frames at 60 fps) before actually taking the snapshot. |
2073 base::MessageLoop::current()->PostDelayedTask( | 2073 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
2074 FROM_HERE, | 2074 FROM_HERE, |
2075 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, | 2075 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, |
2076 weak_factory_.GetWeakPtr(), | 2076 weak_factory_.GetWeakPtr(), sequence_number), |
2077 sequence_number), | |
2078 base::TimeDelta::FromSecondsD(1. / 6)); | 2077 base::TimeDelta::FromSecondsD(1. / 6)); |
2079 #else | 2078 #else |
2080 WindowSnapshotReachedScreen(sequence_number); | 2079 WindowSnapshotReachedScreen(sequence_number); |
2081 #endif | 2080 #endif |
2082 } | 2081 } |
2083 | 2082 |
2084 latency_tracker_.OnFrameSwapped(latency_info); | 2083 latency_tracker_.OnFrameSwapped(latency_info); |
2085 } | 2084 } |
2086 | 2085 |
2087 void RenderWidgetHostImpl::DidReceiveRendererFrame() { | 2086 void RenderWidgetHostImpl::DidReceiveRendererFrame() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2164 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2166 } | 2165 } |
2167 | 2166 |
2168 BrowserAccessibilityManager* | 2167 BrowserAccessibilityManager* |
2169 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2168 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2170 return delegate_ ? | 2169 return delegate_ ? |
2171 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2170 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2172 } | 2171 } |
2173 | 2172 |
2174 } // namespace content | 2173 } // namespace content |
OLD | NEW |