Index: cc/ganesh_resource_provider.h |
diff --git a/cc/ganesh_resource_provider.h b/cc/ganesh_resource_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd6e94bdb2c1cf1681b2267a8f964a5950f93b8d |
--- /dev/null |
+++ b/cc/ganesh_resource_provider.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2013 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 CC_GANESH_RESOURCE_PROVIDER_H_ |
+#define CC_GANESH_RESOURCE_PROVIDER_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "cc/cc_export.h" |
+ |
+class GrContext; |
+namespace WebKit { class WebGraphicsContext3D; } |
+ |
+namespace cc { |
+class ResourceProvider; |
+ |
+class CC_EXPORT GaneshResourceProvider { |
piman
2013/02/11 18:45:33
nit: GaneshContextProvider?
danakj
2013/02/11 18:58:13
Done.
|
+ public: |
+ static scoped_ptr<GaneshResourceProvider> Create() { |
+ return make_scoped_ptr(new GaneshResourceProvider()); |
+ } |
+ ~GaneshResourceProvider(); |
+ |
+ void set_contexts(WebKit::WebGraphicsContext3D* context3d, |
+ GrContext* gr_context) { |
+ context3d_ = context3d; |
+ gr_context_ = gr_context; |
+ } |
+ |
+ bool has_contexts() { return context3d_ && gr_context_; } |
+ |
+ class CC_EXPORT ScopedContexts { |
+ public: |
+ explicit ScopedContexts(GaneshResourceProvider* ganesh_resource_provider); |
+ ~ScopedContexts(); |
+ |
+ WebKit::WebGraphicsContext3D* context3d() { |
+ return ganesh_resource_provider_->context3d_; |
+ } |
+ GrContext* gr_context() { |
+ return ganesh_resource_provider_->gr_context_; |
+ } |
+ |
+ protected: |
+ GaneshResourceProvider* ganesh_resource_provider_; |
+ }; |
+ |
+ class CC_EXPORT ScopedContextsFlushed : public ScopedContexts { |
+ public: |
+ ScopedContextsFlushed(ResourceProvider* resource_provider, |
+ GaneshResourceProvider* ganesh_resource_provider); |
+ ~ScopedContextsFlushed(); |
+ }; |
+ |
+ protected: |
+ GaneshResourceProvider(); |
+ |
+ private: |
+ WebKit::WebGraphicsContext3D* context3d_; |
+ GrContext* gr_context_; |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_GANESH_RESOURCE_PROVIDER_H_ |