Chromium Code Reviews| 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 "base/memory/scoped_ptr.h" | |
| 9 #include "cc/cc_export.h" | |
| 10 | |
| 11 class GrContext; | |
| 12 namespace WebKit { class WebGraphicsContext3D; } | |
| 13 | |
| 14 namespace cc { | |
| 15 class ResourceProvider; | |
| 16 | |
| 17 class CC_EXPORT GaneshResourceProvider { | |
|
piman
2013/02/11 18:45:33
nit: GaneshContextProvider?
danakj
2013/02/11 18:58:13
Done.
| |
| 18 public: | |
| 19 static scoped_ptr<GaneshResourceProvider> Create() { | |
| 20 return make_scoped_ptr(new GaneshResourceProvider()); | |
| 21 } | |
| 22 ~GaneshResourceProvider(); | |
| 23 | |
| 24 void set_contexts(WebKit::WebGraphicsContext3D* context3d, | |
| 25 GrContext* gr_context) { | |
| 26 context3d_ = context3d; | |
| 27 gr_context_ = gr_context; | |
| 28 } | |
| 29 | |
| 30 bool has_contexts() { return context3d_ && gr_context_; } | |
| 31 | |
| 32 class CC_EXPORT ScopedContexts { | |
| 33 public: | |
| 34 explicit ScopedContexts(GaneshResourceProvider* ganesh_resource_provider); | |
| 35 ~ScopedContexts(); | |
| 36 | |
| 37 WebKit::WebGraphicsContext3D* context3d() { | |
| 38 return ganesh_resource_provider_->context3d_; | |
| 39 } | |
| 40 GrContext* gr_context() { | |
| 41 return ganesh_resource_provider_->gr_context_; | |
| 42 } | |
| 43 | |
| 44 protected: | |
| 45 GaneshResourceProvider* ganesh_resource_provider_; | |
| 46 }; | |
| 47 | |
| 48 class CC_EXPORT ScopedContextsFlushed : public ScopedContexts { | |
| 49 public: | |
| 50 ScopedContextsFlushed(ResourceProvider* resource_provider, | |
| 51 GaneshResourceProvider* ganesh_resource_provider); | |
| 52 ~ScopedContextsFlushed(); | |
| 53 }; | |
| 54 | |
| 55 protected: | |
| 56 GaneshResourceProvider(); | |
| 57 | |
| 58 private: | |
| 59 WebKit::WebGraphicsContext3D* context3d_; | |
| 60 GrContext* gr_context_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace cc | |
| 64 | |
| 65 #endif // CC_GANESH_RESOURCE_PROVIDER_H_ | |
| OLD | NEW |