Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef SKY_SHELL_GPU_RASTERIZER_H_ | 5 #ifndef SKY_SHELL_GPU_RASTERIZER_H_ |
| 6 #define SKY_SHELL_GPU_RASTERIZER_H_ | 6 #define SKY_SHELL_GPU_RASTERIZER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "skia/ext/refptr.h" | 10 #include "skia/ext/refptr.h" |
| 11 #include "sky/shell/gpu_delegate.h" | |
| 11 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 class SkPicture; | 15 class SkPicture; |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class GLContext; | 18 class GLContext; |
| 18 class GLShareGroup; | 19 class GLShareGroup; |
| 19 class GLSurface; | 20 class GLSurface; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace sky { | 23 namespace sky { |
| 23 namespace shell { | 24 namespace shell { |
| 24 class GaneshContext; | 25 class GaneshContext; |
| 25 class GaneshSurface; | 26 class GaneshSurface; |
| 26 | 27 |
| 27 class Rasterizer { | 28 class Rasterizer : public GPUDelegate { |
| 28 public: | 29 public: |
| 29 explicit Rasterizer(); | 30 explicit Rasterizer(); |
| 30 ~Rasterizer(); | 31 ~Rasterizer(); |
| 31 | 32 |
| 32 base::WeakPtr<Rasterizer> GetWeakPtr(); | 33 base::WeakPtr<Rasterizer> GetWeakPtr(); |
| 33 | 34 |
| 34 void Init(gfx::AcceleratedWidget widget); | 35 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; |
| 36 void OnDestroyed() override; | |
|
eseidel
2015/02/05 05:57:28
Isn't the pattern typically OnGPUDestroyed() so th
abarth-chromium
2015/02/05 06:16:23
Good idea.
abarth-chromium
2015/02/05 06:16:23
Good idea.
| |
| 37 | |
| 35 void Draw(skia::RefPtr<SkPicture> picture); | 38 void Draw(skia::RefPtr<SkPicture> picture); |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 bool CreateGLContext(); | 41 bool CreateGLContext(); |
| 39 void EnsureGaneshSurface(const gfx::Size& size); | 42 void EnsureGaneshSurface(const gfx::Size& size); |
| 40 | 43 |
| 41 scoped_refptr<gfx::GLShareGroup> share_group_; | 44 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 42 scoped_refptr<gfx::GLSurface> surface_; | 45 scoped_refptr<gfx::GLSurface> surface_; |
| 43 scoped_refptr<gfx::GLContext> context_; | 46 scoped_refptr<gfx::GLContext> context_; |
| 44 | 47 |
| 45 scoped_ptr<GaneshContext> ganesh_context_; | 48 scoped_ptr<GaneshContext> ganesh_context_; |
| 46 scoped_ptr<GaneshSurface> ganesh_surface_; | 49 scoped_ptr<GaneshSurface> ganesh_surface_; |
| 47 | 50 |
| 48 base::WeakPtrFactory<Rasterizer> weak_factory_; | 51 base::WeakPtrFactory<Rasterizer> weak_factory_; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(Rasterizer); | 53 DISALLOW_COPY_AND_ASSIGN(Rasterizer); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace shell | 56 } // namespace shell |
| 54 } // namespace sky | 57 } // namespace sky |
| 55 | 58 |
| 56 #endif // SKY_SHELL_GPU_RASTERIZER_H_ | 59 #endif // SKY_SHELL_GPU_RASTERIZER_H_ |
| OLD | NEW |