OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_GANESH_RESOURCE_PROVIDER_H_ |
| 6 #define CC_GANESH_RESOURCE_PROVIDER_H_ |
| 7 |
| 8 #include "cc/cc_export.h" |
| 9 #include "cc/resource_provider.h" |
| 10 #include "skia/ext/refptr.h" |
| 11 |
| 12 class GrContext; |
| 13 class GrTexture; |
| 14 |
| 15 namespace WebKit { class WebGraphicsContext3D; } |
| 16 |
| 17 namespace cc { |
| 18 class Resource; |
| 19 |
| 20 class CC_EXPORT GaneshResourceProvider { |
| 21 public: |
| 22 static scoped_ptr<GaneshResourceProvider> Create() { |
| 23 return make_scoped_ptr(new GaneshResourceProvider()); |
| 24 } |
| 25 ~GaneshResourceProvider(); |
| 26 |
| 27 void set_contexts(WebKit::WebGraphicsContext3D* context3d, |
| 28 GrContext* gr_context) { |
| 29 context3d_ = context3d; |
| 30 gr_context_ = gr_context; |
| 31 } |
| 32 |
| 33 bool has_contexts() { return context3d_ && gr_context_; } |
| 34 |
| 35 class CC_EXPORT ScopedContexts { |
| 36 public: |
| 37 explicit ScopedContexts(GaneshResourceProvider* ganesh_resource_provider); |
| 38 ~ScopedContexts(); |
| 39 |
| 40 WebKit::WebGraphicsContext3D* context3d() { |
| 41 return ganesh_resource_provider_->context3d_; |
| 42 } |
| 43 GrContext* gr_context() { |
| 44 return ganesh_resource_provider_->gr_context_; |
| 45 } |
| 46 |
| 47 protected: |
| 48 GaneshResourceProvider* ganesh_resource_provider_; |
| 49 }; |
| 50 |
| 51 class CC_EXPORT ScopedContextsFlushed : public ScopedContexts { |
| 52 public: |
| 53 ScopedContextsFlushed(ResourceProvider* resource_provider, |
| 54 GaneshResourceProvider* ganesh_resource_provider); |
| 55 ~ScopedContextsFlushed(); |
| 56 }; |
| 57 |
| 58 protected: |
| 59 GaneshResourceProvider(); |
| 60 |
| 61 private: |
| 62 WebKit::WebGraphicsContext3D* context3d_; |
| 63 GrContext* gr_context_; |
| 64 }; |
| 65 |
| 66 } // namespace cc |
| 67 |
| 68 #endif // CC_GANESH_RESOURCE_PROVIDER_H_ |
OLD | NEW |