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

Unified Diff: ui/gl/context_provider.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: Android build 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: ui/gl/context_provider.h
diff --git a/ui/gl/context_provider.h b/ui/gl/context_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d0eba33bf38d3a938c9c9c097908aa63e9fe476
--- /dev/null
+++ b/ui/gl/context_provider.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 UI_GL_CONTEXT_PROVIDER_H_
+#define UI_GL_CONTEXT_PROVIDER_H_
+
+#include "base/memory/ref_counted.h"
+
+class GrContext;
+namespace WebKit { class WebGraphicsContext3D; }
piman 2013/02/21 22:49:48 nit: It's a bit weird to have this file in ui/gl,
danakj 2013/02/22 01:56:31 Oh, somehow I thought cc can't see webkit/gpu, but
danakj 2013/02/22 01:59:28 Or actually there's a TODO in our DEPS, which I gu
+
+namespace ui {
+
+class ContextProvider : public base::RefCounted<ContextProvider> {
piman 2013/02/21 22:49:48 RefCountedThreadSafe
danakj 2013/02/22 01:56:31 Aahh ok!
+ public:
+ // Initialize and create a 3d context. This must be called from the main
+ // thread. Calling it more than once should have no effect.
+ virtual bool InitializeOnMainThread() = 0;
+
+ // Bind the 3d context to the current thread. This should be called before
+ // accessing the contexts. Calling it more than once should have no effect.
+ // Once this function has been called, the class should only be accessed
+ // from the same thread.
+ virtual bool BindToCurrentThread() = 0;
+
+ virtual WebKit::WebGraphicsContext3D* Context3d() = 0;
+ virtual class GrContext* GrContext() = 0;
+
+ // Ask the provider to check if the contexts are valid or lost. If they are,
+ // this should invalidate the provider so that it can be replaced with a new
+ // one.
+ virtual void VerifyContexts() = 0;
+
+ protected:
+ friend class base::RefCounted<ContextProvider>;
+ virtual ~ContextProvider() {}
+};
+
+} // namespace ui
+
+#endif // UI_GL_CONTEXT_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698