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

Unified Diff: cc/CCDelegatedRendererLayerImpl.cpp

Issue 10915298: Add CCDelegatingRenderer, and corresponding IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 8 years, 2 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 | « cc/CCDelegatedRendererLayerImpl.h ('k') | cc/CCDelegatingRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCDelegatedRendererLayerImpl.cpp
diff --git a/cc/CCDelegatedRendererLayerImpl.cpp b/cc/CCDelegatedRendererLayerImpl.cpp
index 02d569835fe8aaafb6ea89ada2c206aa0f277e4b..eed9843a031d9a1c3463810073126b1b9852f6b9 100644
--- a/cc/CCDelegatedRendererLayerImpl.cpp
+++ b/cc/CCDelegatedRendererLayerImpl.cpp
@@ -7,8 +7,9 @@
#include "CCDelegatedRendererLayerImpl.h"
#include "CCAppendQuadsData.h"
-#include "CCQuadSink.h"
+#include "CCLayerTreeHostImpl.h"
#include "CCMathUtil.h"
+#include "CCQuadSink.h"
#include "CCRenderPassDrawQuad.h"
#include "CCRenderPassSink.h"
@@ -16,12 +17,14 @@ namespace cc {
CCDelegatedRendererLayerImpl::CCDelegatedRendererLayerImpl(int id)
: CCLayerImpl(id)
+ , m_childId(0)
{
}
CCDelegatedRendererLayerImpl::~CCDelegatedRendererLayerImpl()
{
clearRenderPasses();
+ clearChild();
}
bool CCDelegatedRendererLayerImpl::descendantDrawsContent()
@@ -69,9 +72,29 @@ void CCDelegatedRendererLayerImpl::clearRenderPasses()
m_renderPassesInDrawOrder.clear();
}
+void CCDelegatedRendererLayerImpl::clearChild()
+{
+ if (!m_childId)
+ return;
+ CCResourceProvider* resourceProvider = layerTreeHostImpl()->resourceProvider();
+ resourceProvider->destroyChild(m_childId);
+ m_childId = 0;
+}
+
void CCDelegatedRendererLayerImpl::didLoseContext()
{
clearRenderPasses();
+ clearChild();
+}
+
+static int pool = 3;
+
+void CCDelegatedRendererLayerImpl::createChild()
+{
+ if (!m_childId) {
+ CCResourceProvider* resourceProvider = layerTreeHostImpl()->resourceProvider();
+ m_childId = resourceProvider->createChild(pool++);
+ }
}
static inline int indexToId(int index) { return index + 1; }
« no previous file with comments | « cc/CCDelegatedRendererLayerImpl.h ('k') | cc/CCDelegatingRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698