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

Unified Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 12340076: cc: Only create compositor context once. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/render_widget_compositor.cc
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 4eb81d9d52744bbd1286918bb28c0b2c6b05a6c3..8bcc8e208b39f97232653bfc45dea941c3b2f650 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -470,10 +470,14 @@ RenderWidgetCompositor::OffscreenContextProviderForMainThread() {
class RenderWidgetCompositor::CompositorThreadContextProvider
: public cc::ContextProvider {
public:
- CompositorThreadContextProvider() : destroyed_(false) {}
+ CompositorThreadContextProvider() : initialized_(false), destroyed_(false) {}
virtual bool InitializeOnMainThread() OVERRIDE {
- return WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext();
+ if (!initialized_) {
+ initialized_ =
+ WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext();
+ }
+ return initialized_;
}
virtual bool BindToCurrentThread() OVERRIDE {
return Context3d()->makeContextCurrent();
@@ -501,6 +505,8 @@ class RenderWidgetCompositor::CompositorThreadContextProvider
virtual ~CompositorThreadContextProvider() {}
private:
+ bool initialized_;
+
base::Lock destroyed_lock_;
bool destroyed_;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698