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_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1511 if (!using_browser_compositor_) | 1511 if (!using_browser_compositor_) |
1512 SetBeginFrameSource(nullptr); | 1512 SetBeginFrameSource(nullptr); |
1513 // If the DFH has already been destroyed, it will have cleaned itself up. | 1513 // If the DFH has already been destroyed, it will have cleaned itself up. |
1514 // This happens in some WebView cases. | 1514 // This happens in some WebView cases. |
1515 if (delegated_frame_host_) | 1515 if (delegated_frame_host_) |
1516 delegated_frame_host_->UnregisterFrameSinkHierarchy(); | 1516 delegated_frame_host_->UnregisterFrameSinkHierarchy(); |
1517 DCHECK(!begin_frame_source_); | 1517 DCHECK(!begin_frame_source_); |
1518 } | 1518 } |
1519 | 1519 |
1520 void RenderWidgetHostViewAndroid::SendBeginFrame(cc::BeginFrameArgs args) { | 1520 void RenderWidgetHostViewAndroid::SendBeginFrame(cc::BeginFrameArgs args) { |
1521 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", | 1521 TRACE_EVENT2("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", |
1522 "frame_time_us", args.frame_time.ToInternalValue()); | 1522 "frame_number", args.sequence_number, "frame_time_us", |
1523 args.frame_time.ToInternalValue()); | |
1523 | 1524 |
1524 // Synchronous compositor does not use deadline-based scheduling. | 1525 // Synchronous compositor does not use deadline-based scheduling. |
1525 // TODO(brianderson): Replace this hardcoded deadline after Android | 1526 // TODO(brianderson): Replace this hardcoded deadline after Android |
1526 // switches to Surfaces and the Browser's commit isn't in the critical path. | 1527 // switches to Surfaces and the Browser's commit isn't in the critical path. |
1527 args.deadline = sync_compositor_ ? base::TimeTicks() | 1528 args.deadline = sync_compositor_ ? base::TimeTicks() |
1528 : args.frame_time + (args.interval * 0.6); | 1529 : args.frame_time + (args.interval * 0.6); |
1529 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 1530 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
1530 if (sync_compositor_) | 1531 if (sync_compositor_) |
1531 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); | 1532 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); |
1532 } | 1533 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1918 TRACE_EVENT0("cc,benchmark", "RenderWidgetHostViewAndroid::OnBeginFrame"); | 1919 TRACE_EVENT0("cc,benchmark", "RenderWidgetHostViewAndroid::OnBeginFrame"); |
1919 if (!host_) | 1920 if (!host_) |
1920 return; | 1921 return; |
1921 | 1922 |
1922 // In sync mode, we disregard missed frame args to ensure that | 1923 // In sync mode, we disregard missed frame args to ensure that |
1923 // SynchronousCompositorBrowserFilter::SyncStateAfterVSync will be called | 1924 // SynchronousCompositorBrowserFilter::SyncStateAfterVSync will be called |
1924 // during WindowAndroid::WindowBeginFrameSource::OnVSync() observer iteration. | 1925 // during WindowAndroid::WindowBeginFrameSource::OnVSync() observer iteration. |
1925 if (sync_compositor_ && args.type == cc::BeginFrameArgs::MISSED) | 1926 if (sync_compositor_ && args.type == cc::BeginFrameArgs::MISSED) |
1926 return; | 1927 return; |
1927 | 1928 |
1928 // Update |last_begin_frame_args_| before handling | 1929 // crbug.com/675289: Update |last_begin_frame_args_| before handling |
nasko
2016/12/21 17:31:45
nit: https:// so code search can linkify it.
Eric Seckler
2016/12/22 09:20:27
Uh, this must have snuck back during rebase. Shoul
| |
1929 // |outstanding_begin_frame_requests_| to prevent the BeginFrameSource from | 1930 // |outstanding_begin_frame_requests_| to prevent the BeginFrameSource from |
1930 // sending the same MISSED args in infinite recursion. This may otherwise | 1931 // sending the same MISSED args in infinite recursion. This may otherwise |
1931 // happen if |host_->FlushInput()| causes a synchronous OnSetNeedsFlushInput() | 1932 // happen if |host_->FlushInput()| causes a synchronous OnSetNeedsFlushInput() |
1932 // which can lead to |begin_frame_source_->AddObserver()| and OnBeginFrame(). | 1933 // which can lead to |begin_frame_source_->AddObserver()| and OnBeginFrame(). |
1933 // By setting |last_begin_frame_args_|, we indicate to the source not to send | 1934 // By setting |last_begin_frame_args_|, we indicate to the source not to send |
1934 // the same args during |AddObserver()| again. | 1935 // the same args during |AddObserver()| again. |
1935 last_begin_frame_args_ = args; | 1936 last_begin_frame_args_ = args; |
1936 | 1937 |
1937 if (outstanding_begin_frame_requests_ & FLUSH_INPUT) { | 1938 if (outstanding_begin_frame_requests_ & FLUSH_INPUT) { |
1938 ClearBeginFrameRequest(FLUSH_INPUT); | 1939 ClearBeginFrameRequest(FLUSH_INPUT); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2070 if (!compositor) | 2071 if (!compositor) |
2071 return; | 2072 return; |
2072 | 2073 |
2073 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2074 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
2074 overscroll_refresh_handler, compositor, | 2075 overscroll_refresh_handler, compositor, |
2075 ui::GetScaleFactorForNativeView(GetNativeView())); | 2076 ui::GetScaleFactorForNativeView(GetNativeView())); |
2076 is_showing_overscroll_glow_ = true; | 2077 is_showing_overscroll_glow_ = true; |
2077 } | 2078 } |
2078 | 2079 |
2079 } // namespace content | 2080 } // namespace content |
OLD | NEW |