rasterizer_direct.h 1.8 KB
Newer Older
1 2 3 4
// 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.

A
Adam Barth 已提交
5 6
#ifndef SKY_SHELL_GPU_DIRECT_RASTERIZER_H_
#define SKY_SHELL_GPU_DIRECT_RASTERIZER_H_
7 8

#include "base/memory/weak_ptr.h"
9
#include "flow/compositor_context.h"
A
Adam Barth 已提交
10
#include "skia/ext/refptr.h"
11
#include "sky/shell/gpu/direct/ganesh_canvas.h"
A
Adam Barth 已提交
12
#include "sky/shell/rasterizer.h"
13 14 15 16 17 18 19 20 21 22 23 24 25
#include "ui/gfx/native_widget_types.h"

namespace gfx {
class GLContext;
class GLShareGroup;
class GLSurface;
}

namespace sky {
namespace shell {
class GaneshContext;
class GaneshSurface;

A
Adam Barth 已提交
26
class RasterizerDirect : public Rasterizer {
27
 public:
28 29
  explicit RasterizerDirect();
  ~RasterizerDirect() override;
30

31
  base::WeakPtr<RasterizerDirect> GetWeakPtr();
F
Florian Loitsch 已提交
32 33 34 35 36

  base::WeakPtr<::sky::shell::Rasterizer> GetWeakRasterizerPtr() override;

  void ConnectToRasterizer(
      mojo::InterfaceRequest<rasterizer::Rasterizer> request) override;
37

A
Adam Barth 已提交
38 39
  void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
  void OnOutputSurfaceDestroyed();
40

41 42
  flow::LayerTree* GetLastLayerTree() override;

43
 private:
F
Florian Loitsch 已提交
44 45
  void Draw(uint64_t layer_tree_ptr, const DrawCallback& callback) override;

A
Adam Barth 已提交
46
  void EnsureGLContext();
47 48 49 50 51

  scoped_refptr<gfx::GLShareGroup> share_group_;
  scoped_refptr<gfx::GLSurface> surface_;
  scoped_refptr<gfx::GLContext> context_;

52 53
  skia::RefPtr<const GrGLInterface> gr_gl_interface_;
  GaneshCanvas ganesh_canvas_;
54

55
  flow::CompositorContext compositor_context_;
56

F
Florian Loitsch 已提交
57 58
  mojo::Binding<rasterizer::Rasterizer> binding_;

59 60
  std::unique_ptr<flow::LayerTree> last_layer_tree_;

61
  base::WeakPtrFactory<RasterizerDirect> weak_factory_;
62

63
  DISALLOW_COPY_AND_ASSIGN(RasterizerDirect);
64 65 66 67 68
};

}  // namespace shell
}  // namespace sky

A
Adam Barth 已提交
69
#endif  // SKY_SHELL_GPU_DIRECT_RASTERIZER_H_