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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 12197004: cc: Enforce correct recycling in resource pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use fence interface. 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/resource_pool.cc » ('j') | cc/resource_pool.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 { 834 {
835 DCHECK(m_proxy->isImplThread()); 835 DCHECK(m_proxy->isImplThread());
836 return m_renderer && m_renderer->isContextLost(); 836 return m_renderer && m_renderer->isContextLost();
837 } 837 }
838 838
839 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const 839 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
840 { 840 {
841 return m_renderer->capabilities(); 841 return m_renderer->capabilities();
842 } 842 }
843 843
844 namespace {
845 // This implements a simple fence based on client side swaps.
846 // This is to isolate the ResourceProvider from 'frames' which
847 // it shouldn't need to care about, while still allowing us to
848 // enforce correct texture recycling behavior strictly throughout
849 // the compositor. The reason textures are recycled is so that
850 // we can avoid writing to them while they are in use on the GPU.
851 class SimpleSwapFence : public ResourceProvider::Fence {
852 public:
853 SimpleSwapFence() : m_passed(false) {}
854 virtual bool hasPassed() OVERRIDE { return m_passed; }
855 bool setToPassed() { m_passed = true; }
nduca 2013/02/05 22:39:05 m_passed -> m_hasPassed setHasPassed()
epenner 2013/02/05 23:27:36 Done.
856 private:
857 bool m_passed;
858 };
859 }
860
844 bool LayerTreeHostImpl::swapBuffers() 861 bool LayerTreeHostImpl::swapBuffers()
nduca 2013/02/05 22:39:05 what if output_surface.h had a scoped<RefPtr> Reso
piman 2013/02/05 22:46:47 Sadly I don't think it knows about it yet, though
epenner 2013/02/05 23:27:36 Done.
845 { 862 {
846 DCHECK(m_renderer); 863 DCHECK(m_renderer);
847 bool result = m_renderer->swapBuffers(); 864 bool result = m_renderer->swapBuffers();
848 865
866 scoped_refptr<ResourceProvider::Fence> lastSwapFence = m_resourceProvider->g etReadLockFence();
867 if (lastSwapFence)
868 static_cast<SimpleSwapFence*>(lastSwapFence.get())->setToPassed();
869 m_resourceProvider->setReadLockFence(new SimpleSwapFence());
870
piman 2013/02/05 22:19:07 Can we move that logic to the renderer? It shouldn
epenner 2013/02/05 23:27:36 Done.
849 if (m_settings.implSidePainting && 871 if (m_settings.implSidePainting &&
850 !activeTree()->AreVisibleResourcesReady()) { 872 !activeTree()->AreVisibleResourcesReady()) {
851 m_client->didSwapUseIncompleteTileOnImplThread(); 873 m_client->didSwapUseIncompleteTileOnImplThread();
852 } 874 }
853 875
854 return result; 876 return result;
855 } 877 }
856 878
857 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const 879 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
858 { 880 {
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); 1735 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
1714 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); 1736 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>();
1715 } 1737 }
1716 1738
1717 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) 1739 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime)
1718 { 1740 {
1719 m_paintTimeCounter->SavePaintTime(totalPaintTime); 1741 m_paintTimeCounter->SavePaintTime(totalPaintTime);
1720 } 1742 }
1721 1743
1722 } // namespace cc 1744 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resource_pool.cc » ('j') | cc/resource_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698