OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/laser/laser_pointer_view.h" | 5 #include "ash/laser/laser_pointer_view.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 | 10 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 base::TimeTicks next_presentation_time = | 431 base::TimeTicks next_presentation_time = |
432 ui::EventTimeForNow() + presentation_delay_; | 432 ui::EventTimeForNow() + presentation_delay_; |
433 laser_points_.MoveForwardToTime(next_presentation_time); | 433 laser_points_.MoveForwardToTime(next_presentation_time); |
434 predicted_laser_points_.MoveForwardToTime(next_presentation_time); | 434 predicted_laser_points_.MoveForwardToTime(next_presentation_time); |
435 buffer_damage_rect_.Union(GetBoundingBox()); | 435 buffer_damage_rect_.Union(GetBoundingBox()); |
436 OnPointsUpdated(); | 436 OnPointsUpdated(); |
437 } | 437 } |
438 | 438 |
439 void LaserPointerView::DidReceiveCompositorFrameAck( | 439 void LaserPointerView::DidReceiveCompositorFrameAck( |
440 const cc::ReturnedResourceArray& resources) { | 440 const cc::ReturnedResourceArray& resources) { |
441 ReclaimResources(resources); | 441 if (!resources.empty()) |
| 442 ReclaimResources(resources); |
442 | 443 |
443 base::ThreadTaskRunnerHandle::Get()->PostTask( | 444 base::ThreadTaskRunnerHandle::Get()->PostTask( |
444 FROM_HERE, base::Bind(&LaserPointerView::OnDidDrawSurface, | 445 FROM_HERE, base::Bind(&LaserPointerView::OnDidDrawSurface, |
445 weak_ptr_factory_.GetWeakPtr())); | 446 weak_ptr_factory_.GetWeakPtr())); |
446 } | 447 } |
447 | 448 |
448 void LaserPointerView::ReclaimResources( | 449 void LaserPointerView::ReclaimResources( |
449 const cc::ReturnedResourceArray& resources) { | 450 const cc::ReturnedResourceArray& resources) { |
450 DCHECK_EQ(resources.size(), 1u); | 451 DCHECK_EQ(resources.size(), 1u); |
451 | 452 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 pending_draw_surface_ = true; | 765 pending_draw_surface_ = true; |
765 } | 766 } |
766 | 767 |
767 void LaserPointerView::OnDidDrawSurface() { | 768 void LaserPointerView::OnDidDrawSurface() { |
768 pending_draw_surface_ = false; | 769 pending_draw_surface_ = false; |
769 if (needs_update_surface_) | 770 if (needs_update_surface_) |
770 UpdateSurface(); | 771 UpdateSurface(); |
771 } | 772 } |
772 | 773 |
773 } // namespace ash | 774 } // namespace ash |
OLD | NEW |