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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1456 if (host_) | 1456 if (host_) |
1457 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); | 1457 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); |
1458 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | 1458 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
1459 } | 1459 } |
1460 | 1460 |
1461 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, | 1461 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, |
1462 base::TimeDelta vsync_period) { | 1462 base::TimeDelta vsync_period) { |
1463 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", | 1463 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", |
1464 "frame_time_us", frame_time.ToInternalValue()); | 1464 "frame_time_us", frame_time.ToInternalValue()); |
1465 | 1465 |
1466 if (using_browser_compositor_) { | 1466 // The synchronous compositor synchronously does it's work in this call. |
1467 // TODO(brianderson): Replace this hardcoded deadline after Android | 1467 // It does not use a deadline. |
no sievers
2016/06/03 20:35:50
nit: s/it's/its or rather maybe update the comment
boliu
2016/06/03 21:01:06
rewored
| |
1468 // switches to Surfaces and the Browser's commit isn't in the critcal path. | 1468 // TODO(brianderson): Replace this hardcoded deadline after Android |
1469 base::TimeTicks deadline = frame_time + (vsync_period * 0.6); | 1469 // switches to Surfaces and the Browser's commit isn't in the critcal path. |
1470 | 1470 base::TimeTicks deadline = |
1471 host_->Send(new ViewMsg_BeginFrame( | 1471 sync_compositor_ ? base::TimeTicks() : frame_time + (vsync_period * 0.6); |
1472 host_->GetRoutingID(), | 1472 host_->Send(new ViewMsg_BeginFrame( |
1473 cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline, | 1473 host_->GetRoutingID(), |
1474 vsync_period, cc::BeginFrameArgs::NORMAL))); | 1474 cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline, |
1475 } else if (sync_compositor_) { | 1475 vsync_period, cc::BeginFrameArgs::NORMAL))); |
1476 // The synchronous compositor synchronously does it's work in this call. | 1476 if (sync_compositor_) |
1477 // It does not use a deadline. | 1477 sync_compositor_->DidSendBeginFrame(); |
1478 sync_compositor_->BeginFrame(cc::BeginFrameArgs::Create( | |
1479 BEGINFRAME_FROM_HERE, frame_time, base::TimeTicks(), vsync_period, | |
1480 cc::BeginFrameArgs::NORMAL)); | |
1481 } | |
1482 } | 1478 } |
1483 | 1479 |
1484 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1480 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
1485 bool needs_animate = false; | 1481 bool needs_animate = false; |
1486 if (overscroll_controller_) { | 1482 if (overscroll_controller_) { |
1487 needs_animate |= overscroll_controller_->Animate( | 1483 needs_animate |= overscroll_controller_->Animate( |
1488 frame_time, content_view_core_->GetLayer().get()); | 1484 frame_time, content_view_core_->GetLayer().get()); |
1489 } | 1485 } |
1490 if (selection_controller_) | 1486 if (selection_controller_) |
1491 needs_animate |= selection_controller_->Animate(frame_time); | 1487 needs_animate |= selection_controller_->Animate(frame_time); |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2045 case ui::MotionEvent::ACTION_UP: | 2041 case ui::MotionEvent::ACTION_UP: |
2046 case ui::MotionEvent::ACTION_POINTER_UP: | 2042 case ui::MotionEvent::ACTION_POINTER_UP: |
2047 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2043 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
2048 delta.InMicroseconds(), 1, 1000000, 50); | 2044 delta.InMicroseconds(), 1, 1000000, 50); |
2049 default: | 2045 default: |
2050 return; | 2046 return; |
2051 } | 2047 } |
2052 } | 2048 } |
2053 | 2049 |
2054 } // namespace content | 2050 } // namespace content |
OLD | NEW |