Index: content/common/gpu/client/offscreen_context.h |
diff --git a/content/common/gpu/client/offscreen_context.h b/content/common/gpu/client/offscreen_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..700f45f72c3db0aaffbfaa97b314e8de88827a38 |
--- /dev/null |
+++ b/content/common/gpu/client/offscreen_context.h |
@@ -0,0 +1,42 @@ |
+// Copyright (c) 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 CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_H_ |
+ |
+#include "skia/ext/refptr.h" |
+ |
+class GrContext; |
+namespace WebKit { class WebGraphicsContext3D; } |
+ |
+namespace content { |
+ |
+// This class lazily creates an offscreen GrContext that is bound to an |
+// offscreen context lazily created by its subclass implementation. |
+class OffscreenContext { |
+ public: |
+ OffscreenContext(); |
+ virtual ~OffscreenContext(); |
+ |
+ virtual WebKit::WebGraphicsContext3D* Context3d() = 0; |
+ class GrContext* GrContext(); |
+ |
+ protected: |
+ void SetGaneshContextMemoryLimit(bool nonzero_allocation); |
+ void DidLoseContext(); |
+ |
+ private: |
+ // The limit of the number of textures we hold in the GrContext's |
+ // bitmap->texture cache. |
+ static const int kMaxGaneshTextureCacheCount = 2048; |
+ // The limit of the bytes allocated toward textures in the GrContext's |
+ // bitmap->texture cache. |
+ static const size_t kMaxGaneshTextureCacheBytes = 96 * 1024 * 1024; |
+ |
+ skia::RefPtr<class GrContext> gr_context_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_H_ |