| 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..97d281b0d510e56b51378cb2462d2a09076f587d 100644
|
| --- a/ash/laser/laser_pointer_view.h
|
| +++ b/ash/laser/laser_pointer_view.h
|
| @@ -5,10 +5,20 @@
|
| #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/ipc/compositor_frame.mojom.h"
|
| +#include "cc/ipc/mojo_compositor_frame_sink.mojom.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 "mojo/public/cpp/bindings/strong_binding.h"
|
| #include "ui/views/view.h"
|
|
|
| namespace aura {
|
| @@ -16,6 +26,7 @@ class Window;
|
| }
|
|
|
| namespace gfx {
|
| +class GpuMemoryBuffer;
|
| class Point;
|
| }
|
|
|
| @@ -24,11 +35,14 @@ 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::mojom::MojoCompositorFrameSink,
|
| + public cc::CompositorFrameSinkSupportClient {
|
| public:
|
| LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window);
|
| ~LaserPointerView() override;
|
| @@ -37,16 +51,46 @@ class LaserPointerView : public views::View {
|
| void UpdateTime();
|
| void Stop();
|
|
|
| + // Overridden from cc::mojom::MojoCompositorFrameSink:
|
| + void SetNeedsBeginFrame(bool needs_begin_frame) override;
|
| + void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id,
|
| + cc::CompositorFrame frame) override;
|
| + void EvictFrame() override;
|
| +
|
| + // 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);
|
| };
|
|
|