Chromium Code Reviews| Index: ash/laser/laser_pointer_view.h |
| diff --git a/ash/laser/laser_pointer_view.h b/ash/laser/laser_pointer_view.h |
| index 11acfcb93db2053a8ff3db30322126126ba17d97..5b046e006a31e5f69637c6b22920dc87f6fcbbf4 100644 |
| --- a/ash/laser/laser_pointer_view.h |
| +++ b/ash/laser/laser_pointer_view.h |
| @@ -5,10 +5,17 @@ |
| #ifndef ASH_LASER_LASER_POINTER_VIEW_H_ |
| #define ASH_LASER_LASER_POINTER_VIEW_H_ |
| +#include <deque> |
| #include <memory> |
| +#include <unordered_map> |
| #include "ash/laser/laser_pointer_points.h" |
| #include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "cc/resources/texture_mailbox.h" |
| +#include "cc/surfaces/compositor_frame_sink_support.h" |
| +#include "cc/surfaces/compositor_frame_sink_support_client.h" |
| +#include "cc/surfaces/local_surface_id_allocator.h" |
| #include "ui/views/view.h" |
| namespace aura { |
| @@ -16,6 +23,7 @@ class Window; |
| } |
| namespace gfx { |
| +class GpuMemoryBuffer; |
| class Point; |
| } |
| @@ -24,11 +32,13 @@ class Widget; |
| } |
| namespace ash { |
| +struct LaserResource; |
| // LaserPointerView displays the palette tool laser pointer. It draws the laser, |
| // which consists of a point where the mouse cursor should be, as well as a |
| // trail of lines to help users track. |
| -class LaserPointerView : public views::View { |
| +class LaserPointerView : public views::View, |
| + public cc::CompositorFrameSinkSupportClient { |
|
oshima
2017/02/28 07:40:16
This won't work in mus right? You may disable this
reveman
2017/02/28 17:53:27
I've updated the patch so it should now work with
|
| public: |
| LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window); |
| ~LaserPointerView() override; |
| @@ -37,16 +47,40 @@ class LaserPointerView : public views::View { |
| void UpdateTime(); |
| void Stop(); |
| + // Overridden from cc::CompositorFrameSinkSupportClient: |
| + void DidReceiveCompositorFrameAck() override {} |
| + void OnBeginFrame(const cc::BeginFrameArgs& args) override {} |
| + void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| + void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, |
| + const gfx::Rect& damage_rect) override; |
| + |
| private: |
| friend class LaserPointerControllerTestApi; |
| - // view::View: |
| - void OnPaint(gfx::Canvas* canvas) override; |
| - |
| + gfx::Rect GetBoundingBox(); |
| void OnPointsUpdated(); |
| + void UpdateBuffer(); |
| + void OnBufferUpdated(); |
| + void UpdateSurface(); |
| + void OnDidDrawSurface(); |
| LaserPointerPoints laser_points_; |
| std::unique_ptr<views::Widget> widget_; |
| + float scale_factor_ = 1.0f; |
| + std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; |
| + gfx::Rect buffer_damage_rect_; |
| + bool pending_update_buffer_ = false; |
| + gfx::Rect surface_damage_rect_; |
| + bool needs_update_surface_ = false; |
| + bool pending_draw_surface_ = false; |
| + const cc::FrameSinkId frame_sink_id_; |
| + cc::CompositorFrameSinkSupport frame_sink_support_; |
| + cc::LocalSurfaceId local_surface_id_; |
| + cc::LocalSurfaceIdAllocator id_allocator_; |
| + int next_resource_id_ = 1; |
| + std::unordered_map<int, std::unique_ptr<LaserResource>> resources_; |
| + std::deque<std::unique_ptr<LaserResource>> returned_resources_; |
| + base::WeakPtrFactory<LaserPointerView> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(LaserPointerView); |
| }; |