Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: content/common/gpu/client/offscreen_context.h

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put OffscreenContext class in content/common/gpu/client for renderer Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698