// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SKY_SHELL_GPU_DIRECT_RASTERIZER_H_ #define SKY_SHELL_GPU_DIRECT_RASTERIZER_H_ #include "base/memory/weak_ptr.h" #include "flow/compositor_context.h" #include "skia/ext/refptr.h" #include "sky/shell/gpu/direct/ganesh_canvas.h" #include "sky/shell/rasterizer.h" #include "ui/gfx/native_widget_types.h" namespace gfx { class GLContext; class GLShareGroup; class GLSurface; } namespace sky { namespace shell { class GaneshContext; class GaneshSurface; class RasterizerDirect : public Rasterizer { public: explicit RasterizerDirect(); ~RasterizerDirect() override; base::WeakPtr GetWeakPtr(); base::WeakPtr<::sky::shell::Rasterizer> GetWeakRasterizerPtr() override; void ConnectToRasterizer( mojo::InterfaceRequest request) override; void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); void OnOutputSurfaceDestroyed(); flow::LayerTree* GetLastLayerTree() override; private: void Draw(uint64_t layer_tree_ptr, const DrawCallback& callback) override; void EnsureGLContext(); scoped_refptr share_group_; scoped_refptr surface_; scoped_refptr context_; skia::RefPtr gr_gl_interface_; GaneshCanvas ganesh_canvas_; flow::CompositorContext compositor_context_; mojo::Binding binding_; std::unique_ptr last_layer_tree_; base::WeakPtrFactory weak_factory_; DISALLOW_COPY_AND_ASSIGN(RasterizerDirect); }; } // namespace shell } // namespace sky #endif // SKY_SHELL_GPU_DIRECT_RASTERIZER_H_