summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreveman@google.com <reveman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 21:16:40 +0000
committerreveman@google.com <reveman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 21:16:40 +0000
commit3b10a30273e8efe972c623f859a50b5a8643a063 (patch)
tree4cf6423c7541350104105c61cb3293356805bfa4
parent34f3e03f8de771a2bf954c9f029804768fec2a5b (diff)
downloadchromium_src-3b10a30273e8efe972c623f859a50b5a8643a063.zip
chromium_src-3b10a30273e8efe972c623f859a50b5a8643a063.tar.gz
chromium_src-3b10a30273e8efe972c623f859a50b5a8643a063.tar.bz2
cc: Rename PrioritizedTexture to PrioritizedResource.
sed -e ' s/PrioritizedTexture/PrioritizedResource/g s/prioritized_texture/prioritized_resource/g s/PRIORITIZED_TEXTURE/PRIORITIZED_RESOURCE/g s/managedTexture/managedResource/g s/textureManager/resourceManager/g s/constentsTextureManager/constentsResourceManager/g ' BUG= TEST=cc_unittests Review URL: https://codereview.chromium.org/11369109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166520 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/bitmap_content_layer_updater.cc8
-rw-r--r--cc/bitmap_content_layer_updater.h6
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.cc6
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.h4
-rw-r--r--cc/cc.gyp8
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/gl_renderer_unittest.cc4
-rw-r--r--cc/image_layer_updater.cc6
-rw-r--r--cc/image_layer_updater.h6
-rw-r--r--cc/layer_tree_host.cc4
-rw-r--r--cc/layer_tree_host.h12
-rw-r--r--cc/layer_tree_host_impl.cc4
-rw-r--r--cc/layer_tree_host_unittest.cc4
-rw-r--r--cc/layer_updater.cc2
-rw-r--r--cc/layer_updater.h12
-rw-r--r--cc/prioritized_resource.cc (renamed from cc/prioritized_texture.cc)44
-rw-r--r--cc/prioritized_resource.h (renamed from cc/prioritized_texture.h)46
-rw-r--r--cc/prioritized_resource_manager.cc (renamed from cc/prioritized_texture_manager.cc)94
-rw-r--r--cc/prioritized_resource_manager.h (renamed from cc/prioritized_texture_manager.h)52
-rw-r--r--cc/prioritized_resource_unittest.cc (renamed from cc/prioritized_texture_unittest.cc)352
-rw-r--r--cc/resource_update.cc4
-rw-r--r--cc/resource_update.h8
-rw-r--r--cc/resource_update_controller.cc4
-rw-r--r--cc/resource_update_controller_unittest.cc14
-rw-r--r--cc/resource_update_queue.cc2
-rw-r--r--cc/single_thread_proxy.cc2
-rw-r--r--cc/skpicture_content_layer_updater.cc8
-rw-r--r--cc/skpicture_content_layer_updater.h6
-rw-r--r--cc/test/tiled_layer_test_common.cc18
-rw-r--r--cc/test/tiled_layer_test_common.h14
-rw-r--r--cc/texture_uploader.cc2
-rw-r--r--cc/texture_uploader_unittest.cc2
-rw-r--r--cc/thread_proxy.h2
-rw-r--r--cc/tiled_layer.cc32
-rw-r--r--cc/tiled_layer.h2
-rw-r--r--cc/tiled_layer_unittest.cc154
36 files changed, 475 insertions, 475 deletions
diff --git a/cc/bitmap_content_layer_updater.cc b/cc/bitmap_content_layer_updater.cc
index 64262fb..387a06c 100644
--- a/cc/bitmap_content_layer_updater.cc
+++ b/cc/bitmap_content_layer_updater.cc
@@ -13,7 +13,7 @@
namespace cc {
-BitmapContentLayerUpdater::Resource::Resource(BitmapContentLayerUpdater* updater, scoped_ptr<PrioritizedTexture> texture)
+BitmapContentLayerUpdater::Resource::Resource(BitmapContentLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture)
: LayerUpdater::Resource(texture.Pass())
, m_updater(updater)
{
@@ -43,9 +43,9 @@ BitmapContentLayerUpdater::~BitmapContentLayerUpdater()
{
}
-scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(PrioritizedTextureManager* manager)
+scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
+ return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats& stats)
@@ -58,7 +58,7 @@ void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, co
paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats);
}
-void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
+void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
ResourceUpdate upload = ResourceUpdate::Create(
texture,
diff --git a/cc/bitmap_content_layer_updater.h b/cc/bitmap_content_layer_updater.h
index 948ca81..f951a55d 100644
--- a/cc/bitmap_content_layer_updater.h
+++ b/cc/bitmap_content_layer_updater.h
@@ -22,7 +22,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
public:
class Resource : public LayerUpdater::Resource {
public:
- Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedTexture>);
+ Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
virtual ~Resource();
virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
@@ -35,9 +35,9 @@ public:
static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTextureManager*) OVERRIDE;
+ virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
- void updateTexture(ResourceUpdateQueue&, PrioritizedTexture*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
+ void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
virtual void setOpaque(bool) OVERRIDE;
diff --git a/cc/bitmap_skpicture_content_layer_updater.cc b/cc/bitmap_skpicture_content_layer_updater.cc
index a7e6756..cd77aae 100644
--- a/cc/bitmap_skpicture_content_layer_updater.cc
+++ b/cc/bitmap_skpicture_content_layer_updater.cc
@@ -15,7 +15,7 @@
namespace cc {
-BitmapSkPictureContentLayerUpdater::Resource::Resource(BitmapSkPictureContentLayerUpdater* updater, scoped_ptr<PrioritizedTexture> texture)
+BitmapSkPictureContentLayerUpdater::Resource::Resource(BitmapSkPictureContentLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture)
: ContentLayerUpdater::Resource(texture.Pass())
, m_updater(updater)
{
@@ -54,9 +54,9 @@ BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater()
{
}
-scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::createResource(PrioritizedTextureManager* manager)
+scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
+ return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
void BitmapSkPictureContentLayerUpdater::paintContentsRect(SkCanvas* canvas, const gfx::Rect& sourceRect, RenderingStats& stats)
diff --git a/cc/bitmap_skpicture_content_layer_updater.h b/cc/bitmap_skpicture_content_layer_updater.h
index ed1c332..db09eb7 100644
--- a/cc/bitmap_skpicture_content_layer_updater.h
+++ b/cc/bitmap_skpicture_content_layer_updater.h
@@ -16,7 +16,7 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
public:
class Resource : public ContentLayerUpdater::Resource {
public:
- Resource(BitmapSkPictureContentLayerUpdater*, scoped_ptr<PrioritizedTexture>);
+ Resource(BitmapSkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
@@ -29,7 +29,7 @@ public:
static scoped_refptr<BitmapSkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTextureManager*) OVERRIDE;
+ virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
void paintContentsRect(SkCanvas*, const gfx::Rect& sourceRect, RenderingStats&);
private:
diff --git a/cc/cc.gyp b/cc/cc.gyp
index cbb598d..9c10d54 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -112,10 +112,10 @@
'page_scale_animation.cc',
'page_scale_animation.h',
'platform_color.h',
- 'prioritized_texture.cc',
- 'prioritized_texture.h',
- 'prioritized_texture_manager.cc',
- 'prioritized_texture_manager.h',
+ 'prioritized_resource.cc',
+ 'prioritized_resource.h',
+ 'prioritized_resource_manager.cc',
+ 'prioritized_resource_manager.h',
'priority_calculator.cc',
'priority_calculator.h',
'program_binding.cc',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index e043d2f..cc96c31 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -32,7 +32,7 @@
'nine_patch_layer_impl_unittest.cc',
'nine_patch_layer_unittest.cc',
'occlusion_tracker_unittest.cc',
- 'prioritized_texture_unittest.cc',
+ 'prioritized_resource_unittest.cc',
'quad_culler_unittest.cc',
'render_pass_unittest.cc',
'render_surface_filters_unittest.cc',
diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc
index bb0e9c6..ba473ae6 100644
--- a/cc/gl_renderer_unittest.cc
+++ b/cc/gl_renderer_unittest.cc
@@ -6,7 +6,7 @@
#include "cc/gl_renderer.h"
#include "cc/draw_quad.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "cc/resource_provider.h"
#include "cc/settings.h"
#include "cc/single_thread_proxy.h"
@@ -61,7 +61,7 @@ public:
: m_setFullRootLayerDamageCount(0)
, m_lastCallWasSetVisibility(0)
, m_rootLayer(LayerImpl::create(1))
- , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryAllocationLimit())
+ , m_memoryAllocationLimitBytes(PrioritizedResourceManager::defaultMemoryAllocationLimit())
{
m_rootLayer->createRenderSurface();
RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId();
diff --git a/cc/image_layer_updater.cc b/cc/image_layer_updater.cc
index 9f73b80..40bf472 100644
--- a/cc/image_layer_updater.cc
+++ b/cc/image_layer_updater.cc
@@ -21,12 +21,12 @@ scoped_refptr<ImageLayerUpdater> ImageLayerUpdater::create()
}
scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::createResource(
- PrioritizedTextureManager* manager)
+ PrioritizedResourceManager* manager)
{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
+ return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
-void ImageLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
+void ImageLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
// Source rect should never go outside the image pixels, even if this
// is requested because the texture extends outside the image.
diff --git a/cc/image_layer_updater.h b/cc/image_layer_updater.h
index 89c26b2..3a70dd3 100644
--- a/cc/image_layer_updater.h
+++ b/cc/image_layer_updater.h
@@ -17,7 +17,7 @@ class ImageLayerUpdater : public LayerUpdater {
public:
class Resource : public LayerUpdater::Resource {
public:
- Resource(ImageLayerUpdater* updater, scoped_ptr<PrioritizedTexture> texture)
+ Resource(ImageLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture)
: LayerUpdater::Resource(texture.Pass())
, m_updater(updater)
{
@@ -32,9 +32,9 @@ public:
static scoped_refptr<ImageLayerUpdater> create();
virtual scoped_ptr<LayerUpdater::Resource> createResource(
- PrioritizedTextureManager*) OVERRIDE;
+ PrioritizedResourceManager*) OVERRIDE;
- void updateTexture(ResourceUpdateQueue&, PrioritizedTexture*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
+ void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
void setBitmap(const SkBitmap&);
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 07d2591..0e0f2d3 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -163,7 +163,7 @@ void LayerTreeHost::initializeRenderer()
// Update m_settings based on partial update capability.
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
- m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool);
+ m_contentsTextureManager = PrioritizedResourceManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool);
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Size(), GL_RGBA);
m_rendererInitialized = true;
@@ -470,7 +470,7 @@ void LayerTreeHost::loseContext(int numTimes)
m_proxy->loseContext();
}
-PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const
+PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const
{
return m_contentsTextureManager.get();
}
diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h
index a0234df..c574888 100644
--- a/cc/layer_tree_host.h
+++ b/cc/layer_tree_host.h
@@ -19,7 +19,7 @@
#include "cc/layer_tree_host_client.h"
#include "cc/layer_tree_host_common.h"
#include "cc/occlusion_tracker.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "cc/proxy.h"
#include "cc/rate_limiter.h"
#include "cc/rendering_stats.h"
@@ -44,7 +44,7 @@ class FontAtlas;
class Layer;
class LayerTreeHostImpl;
class LayerTreeHostImplClient;
-class PrioritizedTextureManager;
+class PrioritizedResourceManager;
class ResourceUpdateQueue;
class HeadsUpDisplayLayer;
class Region;
@@ -184,7 +184,7 @@ public:
void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
- PrioritizedTextureManager* contentsTextureManager() const;
+ PrioritizedResourceManager* contentsTextureManager() const;
bool visible() const { return m_visible; }
void setVisible(bool);
@@ -258,8 +258,8 @@ private:
scoped_refptr<Layer> m_rootLayer;
scoped_refptr<HeadsUpDisplayLayer> m_hudLayer;
- scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager;
- scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder;
+ scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager;
+ scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder;
LayerTreeSettings m_settings;
@@ -280,7 +280,7 @@ private:
SkColor m_backgroundColor;
bool m_hasTransparentBackground;
- typedef ScopedPtrVector<PrioritizedTexture> TextureList;
+ typedef ScopedPtrVector<PrioritizedResource> TextureList;
size_t m_partialTextureUpdateRequests;
static bool s_needsFilterContext;
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 2f5ee5c..6cf0d39 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -23,7 +23,7 @@
#include "cc/math_util.h"
#include "cc/overdraw_metrics.h"
#include "cc/page_scale_animation.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "cc/render_pass_draw_quad.h"
#include "cc/rendering_stats.h"
#include "cc/scrollbar_animation_controller.h"
@@ -216,7 +216,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
, m_deviceScaleFactor(1)
, m_visible(true)
, m_contentsTexturesPurged(false)
- , m_managedMemoryPolicy(PrioritizedTextureManager::defaultMemoryAllocationLimit(),
+ , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationLimit(),
PriorityCalculator::allowEverythingCutoff(),
0,
PriorityCalculator::allowNothingCutoff())
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 1b414a1..5d85f1c 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -2637,12 +2637,12 @@ private:
{
if (m_texture.get())
return;
- m_texture = PrioritizedTexture::create(layerTreeHost()->contentsTextureManager());
+ m_texture = PrioritizedResource::create(layerTreeHost()->contentsTextureManager());
m_texture->setDimensions(gfx::Size(10, 10), GL_RGBA);
m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
}
- scoped_ptr<PrioritizedTexture> m_texture;
+ scoped_ptr<PrioritizedResource> m_texture;
SkBitmap m_bitmap;
};
diff --git a/cc/layer_updater.cc b/cc/layer_updater.cc
index 33daa98..5d021f7 100644
--- a/cc/layer_updater.cc
+++ b/cc/layer_updater.cc
@@ -8,7 +8,7 @@
namespace cc {
-LayerUpdater::Resource::Resource(scoped_ptr<PrioritizedTexture> texture)
+LayerUpdater::Resource::Resource(scoped_ptr<PrioritizedResource> texture)
: m_texture(texture.Pass())
{
}
diff --git a/cc/layer_updater.h b/cc/layer_updater.h
index b2cab71..ccab945 100644
--- a/cc/layer_updater.h
+++ b/cc/layer_updater.h
@@ -7,7 +7,7 @@
#include "base/memory/ref_counted.h"
#include "cc/cc_export.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "third_party/khronos/GLES2/gl2.h"
namespace gfx {
@@ -28,21 +28,21 @@ public:
public:
virtual ~Resource();
- PrioritizedTexture* texture() { return m_texture.get(); }
- void swapTextureWith(scoped_ptr<PrioritizedTexture>& texture) { m_texture.swap(texture); }
+ PrioritizedResource* texture() { return m_texture.get(); }
+ void swapTextureWith(scoped_ptr<PrioritizedResource>& texture) { m_texture.swap(texture); }
// TODO(reveman): partialUpdate should be a property of this class
// instead of an argument passed to update().
virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) = 0;
protected:
- explicit Resource(scoped_ptr<PrioritizedTexture> texture);
+ explicit Resource(scoped_ptr<PrioritizedResource> texture);
private:
- scoped_ptr<PrioritizedTexture> m_texture;
+ scoped_ptr<PrioritizedResource> m_texture;
};
LayerUpdater() { }
- virtual scoped_ptr<Resource> createResource(PrioritizedTextureManager*) = 0;
+ virtual scoped_ptr<Resource> createResource(PrioritizedResourceManager*) = 0;
// The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
// then this region should be ignored in preference for the entire layer's area.
virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&) { }
diff --git a/cc/prioritized_texture.cc b/cc/prioritized_resource.cc
index 5121b7c..14e0cd7 100644
--- a/cc/prioritized_texture.cc
+++ b/cc/prioritized_resource.cc
@@ -4,10 +4,10 @@
#include "config.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/platform_color.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "cc/priority_calculator.h"
#include "cc/proxy.h"
#include <algorithm>
@@ -16,7 +16,7 @@ using namespace std;
namespace cc {
-PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, gfx::Size size, GLenum format)
+PrioritizedResource::PrioritizedResource(PrioritizedResourceManager* manager, gfx::Size size, GLenum format)
: m_size(size)
, m_format(format)
, m_bytes(0)
@@ -35,13 +35,13 @@ PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, gfx::
manager->registerTexture(this);
}
-PrioritizedTexture::~PrioritizedTexture()
+PrioritizedResource::~PrioritizedResource()
{
if (m_manager)
m_manager->unregisterTexture(this);
}
-void PrioritizedTexture::setTextureManager(PrioritizedTextureManager* manager)
+void PrioritizedResource::setTextureManager(PrioritizedResourceManager* manager)
{
if (m_manager == manager)
return;
@@ -51,7 +51,7 @@ void PrioritizedTexture::setTextureManager(PrioritizedTextureManager* manager)
manager->registerTexture(this);
}
-void PrioritizedTexture::setDimensions(gfx::Size size, GLenum format)
+void PrioritizedResource::setDimensions(gfx::Size size, GLenum format)
{
if (m_format != format || m_size != size) {
m_isAbovePriorityCutoff = false;
@@ -64,33 +64,33 @@ void PrioritizedTexture::setDimensions(gfx::Size size, GLenum format)
}
}
-bool PrioritizedTexture::requestLate()
+bool PrioritizedResource::requestLate()
{
if (!m_manager)
return false;
return m_manager->requestLate(this);
}
-bool PrioritizedTexture::backingResourceWasEvicted() const
+bool PrioritizedResource::backingResourceWasEvicted() const
{
return m_backing ? m_backing->resourceHasBeenDeleted() : false;
}
-void PrioritizedTexture::acquireBackingTexture(ResourceProvider* resourceProvider)
+void PrioritizedResource::acquireBackingTexture(ResourceProvider* resourceProvider)
{
DCHECK(m_isAbovePriorityCutoff);
if (m_isAbovePriorityCutoff)
m_manager->acquireBackingTextureIfNeeded(this, resourceProvider);
}
-ResourceProvider::ResourceId PrioritizedTexture::resourceId() const
+ResourceProvider::ResourceId PrioritizedResource::resourceId() const
{
if (m_backing)
return m_backing->id();
return 0;
}
-void PrioritizedTexture::setPixels(ResourceProvider* resourceProvider,
+void PrioritizedResource::setPixels(ResourceProvider* resourceProvider,
const uint8_t* image, const gfx::Rect& imageRect,
const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset)
{
@@ -106,7 +106,7 @@ void PrioritizedTexture::setPixels(ResourceProvider* resourceProvider,
m_contentsSwizzled = !PlatformColor::sameComponentOrder(m_format);
}
-void PrioritizedTexture::link(Backing* backing)
+void PrioritizedResource::link(Backing* backing)
{
DCHECK(backing);
DCHECK(!backing->m_owner);
@@ -116,7 +116,7 @@ void PrioritizedTexture::link(Backing* backing)
m_backing->m_owner = this;
}
-void PrioritizedTexture::unlink()
+void PrioritizedResource::unlink()
{
DCHECK(m_backing);
DCHECK(m_backing->m_owner == this);
@@ -125,14 +125,14 @@ void PrioritizedTexture::unlink()
m_backing = 0;
}
-void PrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes)
+void PrioritizedResource::setToSelfManagedMemoryPlaceholder(size_t bytes)
{
setDimensions(gfx::Size(), GL_RGBA);
setIsSelfManaged(true);
m_bytes = bytes;
}
-PrioritizedTexture::Backing::Backing(unsigned id, ResourceProvider* resourceProvider, gfx::Size size, GLenum format)
+PrioritizedResource::Backing::Backing(unsigned id, ResourceProvider* resourceProvider, gfx::Size size, GLenum format)
: Texture(id, size, format)
, m_owner(0)
, m_priorityAtLastPriorityUpdate(PriorityCalculator::lowestPriority())
@@ -145,13 +145,13 @@ PrioritizedTexture::Backing::Backing(unsigned id, ResourceProvider* resourceProv
{
}
-PrioritizedTexture::Backing::~Backing()
+PrioritizedResource::Backing::~Backing()
{
DCHECK(!m_owner);
DCHECK(m_resourceHasBeenDeleted);
}
-void PrioritizedTexture::Backing::deleteResource(ResourceProvider* resourceProvider)
+void PrioritizedResource::Backing::deleteResource(ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread());
DCHECK(!m_resourceHasBeenDeleted);
@@ -164,19 +164,19 @@ void PrioritizedTexture::Backing::deleteResource(ResourceProvider* resourceProvi
m_resourceHasBeenDeleted = true;
}
-bool PrioritizedTexture::Backing::resourceHasBeenDeleted() const
+bool PrioritizedResource::Backing::resourceHasBeenDeleted() const
{
DCHECK(Proxy::isImplThread());
return m_resourceHasBeenDeleted;
}
-bool PrioritizedTexture::Backing::canBeRecycled() const
+bool PrioritizedResource::Backing::canBeRecycled() const
{
DCHECK(Proxy::isImplThread());
return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree;
}
-void PrioritizedTexture::Backing::updatePriority()
+void PrioritizedResource::Backing::updatePriority()
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
if (m_owner) {
@@ -188,7 +188,7 @@ void PrioritizedTexture::Backing::updatePriority()
}
}
-void PrioritizedTexture::Backing::updateInDrawingImplTree()
+void PrioritizedResource::Backing::updateInDrawingImplTree()
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
m_inDrawingImplTree = !!owner();
@@ -196,7 +196,7 @@ void PrioritizedTexture::Backing::updateInDrawingImplTree()
DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPriority());
}
-void PrioritizedTexture::returnBackingTexture()
+void PrioritizedResource::returnBackingTexture()
{
DCHECK(m_manager || !m_backing);
if (m_manager)
diff --git a/cc/prioritized_texture.h b/cc/prioritized_resource.h
index a9aa5c0..1f2dc57 100644
--- a/cc/prioritized_texture.h
+++ b/cc/prioritized_resource.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_PRIORITIZED_TEXTURE_H_
-#define CC_PRIORITIZED_TEXTURE_H_
+#ifndef CC_PRIORITIZED_RESOURCE_H_
+#define CC_PRIORITIZED_RESOURCE_H_
#include "base/basictypes.h"
#include "base/logging.h"
@@ -19,35 +19,35 @@
namespace cc {
-class PrioritizedTextureManager;
+class PrioritizedResourceManager;
-class CC_EXPORT PrioritizedTexture {
+class CC_EXPORT PrioritizedResource {
public:
- static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager, gfx::Size size, GLenum format)
+ static scoped_ptr<PrioritizedResource> create(PrioritizedResourceManager* manager, gfx::Size size, GLenum format)
{
- return make_scoped_ptr(new PrioritizedTexture(manager, size, format));
+ return make_scoped_ptr(new PrioritizedResource(manager, size, format));
}
- static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager)
+ static scoped_ptr<PrioritizedResource> create(PrioritizedResourceManager* manager)
{
- return make_scoped_ptr(new PrioritizedTexture(manager, gfx::Size(), 0));
+ return make_scoped_ptr(new PrioritizedResource(manager, gfx::Size(), 0));
}
- ~PrioritizedTexture();
+ ~PrioritizedResource();
// Texture properties. Changing these causes the backing texture to be lost.
// Setting these to the same value is a no-op.
- void setTextureManager(PrioritizedTextureManager*);
- PrioritizedTextureManager* textureManager() { return m_manager; }
+ void setTextureManager(PrioritizedResourceManager*);
+ PrioritizedResourceManager* resourceManager() { return m_manager; }
void setDimensions(gfx::Size, GLenum format);
GLenum format() const { return m_format; }
gfx::Size size() const { return m_size; }
size_t bytes() const { return m_bytes; }
bool contentsSwizzled() const { return m_contentsSwizzled; }
- // Set priority for the requested texture.
+ // Set priority for the requested texture.
void setRequestPriority(int priority) { m_priority = priority; }
int requestPriority() const { return m_priority; }
- // After PrioritizedTexture::prioritizeTextures() is called, this returns
+ // After PrioritizedResource::prioritizeTextures() is called, this returns
// if the the request succeeded and this texture can be acquired for use.
bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
@@ -88,8 +88,8 @@ public:
void returnBackingTexture();
private:
- friend class PrioritizedTextureManager;
- friend class PrioritizedTextureTest;
+ friend class PrioritizedResourceManager;
+ friend class PrioritizedResourceTest;
class Backing : public Texture {
public:
@@ -98,7 +98,7 @@ private:
void updatePriority();
void updateInDrawingImplTree();
- PrioritizedTexture* owner() { return m_owner; }
+ PrioritizedResource* owner() { return m_owner; }
bool canBeRecycled() const;
int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLastPriorityUpdate; }
bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAbovePriorityCutoffAtLastPriorityUpdate; }
@@ -108,8 +108,8 @@ private:
bool resourceHasBeenDeleted() const;
private:
- friend class PrioritizedTexture;
- PrioritizedTexture* m_owner;
+ friend class PrioritizedResource;
+ PrioritizedResource* m_owner;
int m_priorityAtLastPriorityUpdate;
bool m_wasAbovePriorityCutoffAtLastPriorityUpdate;
@@ -124,11 +124,11 @@ private:
DISALLOW_COPY_AND_ASSIGN(Backing);
};
- PrioritizedTexture(PrioritizedTextureManager*, gfx::Size, GLenum format);
+ PrioritizedResource(PrioritizedResourceManager*, gfx::Size, GLenum format);
bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; }
- void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = manager; }
+ void setManagerInternal(PrioritizedResourceManager* manager) { m_manager = manager; }
Backing* backing() const { return m_backing; }
void link(Backing*);
@@ -144,11 +144,11 @@ private:
bool m_isSelfManaged;
Backing* m_backing;
- PrioritizedTextureManager* m_manager;
+ PrioritizedResourceManager* m_manager;
- DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture);
+ DISALLOW_COPY_AND_ASSIGN(PrioritizedResource);
};
} // namespace cc
-#endif // CC_PRIORITIZED_TEXTURE_H_
+#endif // CC_PRIORITIZED_RESOURCE_H_
diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_resource_manager.cc
index 3c66903..8748d0f 100644
--- a/cc/prioritized_texture_manager.cc
+++ b/cc/prioritized_resource_manager.cc
@@ -4,11 +4,11 @@
#include "config.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "base/debug/trace_event.h"
#include "base/stl_util.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/priority_calculator.h"
#include "cc/proxy.h"
#include <algorithm>
@@ -17,7 +17,7 @@ using namespace std;
namespace cc {
-PrioritizedTextureManager::PrioritizedTextureManager(size_t maxMemoryLimitBytes, int, int pool)
+PrioritizedResourceManager::PrioritizedResourceManager(size_t maxMemoryLimitBytes, int, int pool)
: m_maxMemoryLimitBytes(maxMemoryLimitBytes)
, m_externalPriorityCutoff(PriorityCalculator::allowEverythingCutoff())
, m_memoryUseBytes(0)
@@ -32,7 +32,7 @@ PrioritizedTextureManager::PrioritizedTextureManager(size_t maxMemoryLimitBytes,
{
}
-PrioritizedTextureManager::~PrioritizedTextureManager()
+PrioritizedResourceManager::~PrioritizedResourceManager()
{
while (m_textures.size() > 0)
unregisterTexture(*m_textures.begin());
@@ -44,21 +44,21 @@ PrioritizedTextureManager::~PrioritizedTextureManager()
DCHECK(m_backings.empty());
}
-size_t PrioritizedTextureManager::memoryVisibleBytes() const
+size_t PrioritizedResourceManager::memoryVisibleBytes() const
{
DCHECK(Proxy::isImplThread());
return m_memoryVisibleLastPushedBytes;
}
-size_t PrioritizedTextureManager::memoryVisibleAndNearbyBytes() const
+size_t PrioritizedResourceManager::memoryVisibleAndNearbyBytes() const
{
DCHECK(Proxy::isImplThread());
return m_memoryVisibleAndNearbyLastPushedBytes;
}
-void PrioritizedTextureManager::prioritizeTextures()
+void PrioritizedResourceManager::prioritizeTextures()
{
- TRACE_EVENT0("cc", "PrioritizedTextureManager::prioritizeTextures");
+ TRACE_EVENT0("cc", "PrioritizedResourceManager::prioritizeTextures");
DCHECK(Proxy::isMainThread());
// Sorting textures in this function could be replaced by a slightly
@@ -72,12 +72,12 @@ void PrioritizedTextureManager::prioritizeTextures()
m_memoryVisibleBytes = 0;
m_memoryVisibleAndNearbyBytes = 0;
for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
- PrioritizedTexture* texture = (*it);
+ PrioritizedResource* texture = (*it);
sortedTextures.push_back(texture);
if (PriorityCalculator::priorityIsHigher(texture->requestPriority(), PriorityCalculator::allowVisibleOnlyCutoff()))
m_memoryVisibleBytes += texture->bytes();
if (PriorityCalculator::priorityIsHigher(texture->requestPriority(), PriorityCalculator::allowVisibleAndNearbyCutoff()))
- m_memoryVisibleAndNearbyBytes += texture->bytes();
+ m_memoryVisibleAndNearbyBytes += texture->bytes();
}
std::sort(sortedTextures.begin(), sortedTextures.end(), compareTextures);
@@ -109,7 +109,7 @@ void PrioritizedTextureManager::prioritizeTextures()
// Disallow any textures with priority below the external cutoff to have backings.
size_t memoryLinkedTexturesBytes = 0;
for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) {
- PrioritizedTexture* texture = (*it);
+ PrioritizedResource* texture = (*it);
if (!PriorityCalculator::priorityIsHigher(texture->requestPriority(), m_externalPriorityCutoff) &&
texture->haveBackingTexture())
texture->unlink();
@@ -132,9 +132,9 @@ void PrioritizedTextureManager::prioritizeTextures()
DCHECK(memoryAboveCutoffBytes() <= maxMemoryLimitBytes());
}
-void PrioritizedTextureManager::pushTexturePrioritiesToBackings()
+void PrioritizedResourceManager::pushTexturePrioritiesToBackings()
{
- TRACE_EVENT0("cc", "PrioritizedTextureManager::pushTexturePrioritiesToBackings");
+ TRACE_EVENT0("cc", "PrioritizedResourceManager::pushTexturePrioritiesToBackings");
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
assertInvariants();
@@ -148,23 +148,23 @@ void PrioritizedTextureManager::pushTexturePrioritiesToBackings()
m_memoryVisibleAndNearbyLastPushedBytes = m_memoryVisibleAndNearbyBytes;
}
-void PrioritizedTextureManager::updateBackingsInDrawingImplTree()
+void PrioritizedResourceManager::updateBackingsInDrawingImplTree()
{
- TRACE_EVENT0("cc", "PrioritizedTextureManager::updateBackingsInDrawingImplTree");
+ TRACE_EVENT0("cc", "PrioritizedResourceManager::updateBackingsInDrawingImplTree");
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
assertInvariants();
for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- PrioritizedTexture::Backing* backing = (*it);
+ PrioritizedResource::Backing* backing = (*it);
backing->updateInDrawingImplTree();
}
sortBackings();
assertInvariants();
}
-void PrioritizedTextureManager::sortBackings()
+void PrioritizedResourceManager::sortBackings()
{
- TRACE_EVENT0("cc", "PrioritizedTextureManager::sortBackings");
+ TRACE_EVENT0("cc", "PrioritizedResourceManager::sortBackings");
DCHECK(Proxy::isImplThread());
// Put backings in eviction/recycling order.
@@ -172,7 +172,7 @@ void PrioritizedTextureManager::sortBackings()
m_backingsTailNotSorted = false;
}
-void PrioritizedTextureManager::clearPriorities()
+void PrioritizedResourceManager::clearPriorities()
{
DCHECK(Proxy::isMainThread());
for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
@@ -184,7 +184,7 @@ void PrioritizedTextureManager::clearPriorities()
}
}
-bool PrioritizedTextureManager::requestLate(PrioritizedTexture* texture)
+bool PrioritizedResourceManager::requestLate(PrioritizedResource* texture)
{
DCHECK(Proxy::isMainThread());
@@ -209,7 +209,7 @@ bool PrioritizedTextureManager::requestLate(PrioritizedTexture* texture)
return true;
}
-void PrioritizedTextureManager::acquireBackingTextureIfNeeded(PrioritizedTexture* texture, ResourceProvider* resourceProvider)
+void PrioritizedResourceManager::acquireBackingTextureIfNeeded(PrioritizedResource* texture, ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
DCHECK(!texture->isSelfManaged());
@@ -218,7 +218,7 @@ void PrioritizedTextureManager::acquireBackingTextureIfNeeded(PrioritizedTexture
return;
// Find a backing below, by either recycling or allocating.
- PrioritizedTexture::Backing* backing = 0;
+ PrioritizedResource::Backing* backing = 0;
// First try to recycle
for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
@@ -249,7 +249,7 @@ void PrioritizedTextureManager::acquireBackingTextureIfNeeded(PrioritizedTexture
backing->updatePriority();
}
-bool PrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, EvictionPolicy evictionPolicy, ResourceProvider* resourceProvider)
+bool PrioritizedResourceManager::evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, EvictionPolicy evictionPolicy, ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread());
if (memoryUseBytes() <= limitBytes && PriorityCalculator::allowEverythingCutoff() == priorityCutoff)
@@ -258,7 +258,7 @@ bool PrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, i
// Destroy backings until we are below the limit,
// or until all backings remaining are above the cutoff.
while (m_backings.size() > 0) {
- PrioritizedTexture::Backing* backing = m_backings.front();
+ PrioritizedResource::Backing* backing = m_backings.front();
if (memoryUseBytes() <= limitBytes &&
PriorityCalculator::priorityIsHigher(backing->requestPriorityAtLastPriorityUpdate(), priorityCutoff))
break;
@@ -269,12 +269,12 @@ bool PrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, i
return true;
}
-void PrioritizedTextureManager::reduceMemory(ResourceProvider* resourceProvider)
+void PrioritizedResourceManager::reduceMemory(ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
// Note that it will not always be the case that memoryUseBytes() <= maxMemoryLimitBytes(),
- // because we are not at liberty to delete textures that are referenced by the impl tree to
+ // because we are not at liberty to delete textures that are referenced by the impl tree to
// get more space.
evictBackingsToReduceMemory(m_memoryAvailableBytes, PriorityCalculator::allowEverythingCutoff(), EvictOnlyRecyclable, resourceProvider);
@@ -304,14 +304,14 @@ void PrioritizedTextureManager::reduceMemory(ResourceProvider* resourceProvider)
deleteUnlinkedEvictedBackings();
}
-void PrioritizedTextureManager::clearAllMemory(ResourceProvider* resourceProvider)
+void PrioritizedResourceManager::clearAllMemory(ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
DCHECK(resourceProvider);
evictBackingsToReduceMemory(0, PriorityCalculator::allowEverythingCutoff(), EvictAnything, resourceProvider);
}
-bool PrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, int priorityCutoff, ResourceProvider* resourceProvider)
+bool PrioritizedResourceManager::reduceMemoryOnImplThread(size_t limitBytes, int priorityCutoff, ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread());
DCHECK(resourceProvider);
@@ -322,29 +322,29 @@ bool PrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, int
return evictBackingsToReduceMemory(limitBytes, priorityCutoff, EvictAnything, resourceProvider);
}
-void PrioritizedTextureManager::getEvictedBackings(BackingList& evictedBackings)
+void PrioritizedResourceManager::getEvictedBackings(BackingList& evictedBackings)
{
DCHECK(Proxy::isImplThread());
evictedBackings.clear();
evictedBackings.insert(evictedBackings.begin(), m_evictedBackings.begin(), m_evictedBackings.end());
}
-void PrioritizedTextureManager::unlinkEvictedBackings(const BackingList& evictedBackings)
+void PrioritizedResourceManager::unlinkEvictedBackings(const BackingList& evictedBackings)
{
DCHECK(Proxy::isMainThread());
for (BackingList::const_iterator it = evictedBackings.begin(); it != evictedBackings.end(); ++it) {
- PrioritizedTexture::Backing* backing = (*it);
+ PrioritizedResource::Backing* backing = (*it);
if (backing->owner())
backing->owner()->unlink();
}
}
-void PrioritizedTextureManager::deleteUnlinkedEvictedBackings()
+void PrioritizedResourceManager::deleteUnlinkedEvictedBackings()
{
DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked()));
BackingList newEvictedBackings;
for (BackingList::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) {
- PrioritizedTexture::Backing* backing = (*it);
+ PrioritizedResource::Backing* backing = (*it);
if (backing->owner())
newEvictedBackings.push_back(backing);
else
@@ -353,7 +353,7 @@ void PrioritizedTextureManager::deleteUnlinkedEvictedBackings()
m_evictedBackings.swap(newEvictedBackings);
}
-bool PrioritizedTextureManager::linkedEvictedBackingsExist() const
+bool PrioritizedResourceManager::linkedEvictedBackingsExist() const
{
for (BackingList::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) {
if ((*it)->owner())
@@ -362,11 +362,11 @@ bool PrioritizedTextureManager::linkedEvictedBackingsExist() const
return false;
}
-void PrioritizedTextureManager::registerTexture(PrioritizedTexture* texture)
+void PrioritizedResourceManager::registerTexture(PrioritizedResource* texture)
{
DCHECK(Proxy::isMainThread());
DCHECK(texture);
- DCHECK(!texture->textureManager());
+ DCHECK(!texture->resourceManager());
DCHECK(!texture->backing());
DCHECK(!ContainsKey(m_textures, texture));
@@ -375,7 +375,7 @@ void PrioritizedTextureManager::registerTexture(PrioritizedTexture* texture)
}
-void PrioritizedTextureManager::unregisterTexture(PrioritizedTexture* texture)
+void PrioritizedResourceManager::unregisterTexture(PrioritizedResource* texture)
{
DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked()));
DCHECK(texture);
@@ -387,29 +387,29 @@ void PrioritizedTextureManager::unregisterTexture(PrioritizedTexture* texture)
texture->setAbovePriorityCutoff(false);
}
-void PrioritizedTextureManager::returnBackingTexture(PrioritizedTexture* texture)
+void PrioritizedResourceManager::returnBackingTexture(PrioritizedResource* texture)
{
DCHECK(Proxy::isMainThread() || (Proxy::isImplThread() && Proxy::isMainThreadBlocked()));
if (texture->backing())
texture->unlink();
}
-PrioritizedTexture::Backing* PrioritizedTextureManager::createBacking(gfx::Size size, GLenum format, ResourceProvider* resourceProvider)
+PrioritizedResource::Backing* PrioritizedResourceManager::createBacking(gfx::Size size, GLenum format, ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
DCHECK(resourceProvider);
ResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, ResourceProvider::TextureUsageAny);
- PrioritizedTexture::Backing* backing = new PrioritizedTexture::Backing(resourceId, resourceProvider, size, format);
+ PrioritizedResource::Backing* backing = new PrioritizedResource::Backing(resourceId, resourceProvider, size, format);
m_memoryUseBytes += backing->bytes();
return backing;
}
-void PrioritizedTextureManager::evictFirstBackingResource(ResourceProvider* resourceProvider)
+void PrioritizedResourceManager::evictFirstBackingResource(ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread());
DCHECK(resourceProvider);
DCHECK(!m_backings.empty());
- PrioritizedTexture::Backing* backing = m_backings.front();
+ PrioritizedResource::Backing* backing = m_backings.front();
// Note that we create a backing and its resource at the same time, but we
// delete the backing structure and its resource in two steps. This is because
@@ -421,7 +421,7 @@ void PrioritizedTextureManager::evictFirstBackingResource(ResourceProvider* reso
m_evictedBackings.push_back(backing);
}
-void PrioritizedTextureManager::assertInvariants()
+void PrioritizedResourceManager::assertInvariants()
{
#ifndef NDEBUG
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
@@ -438,8 +438,8 @@ void PrioritizedTextureManager::assertInvariants()
}
}
for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
- PrioritizedTexture* texture = (*it);
- PrioritizedTexture::Backing* backing = texture->backing();
+ PrioritizedResource* texture = (*it);
+ PrioritizedResource::Backing* backing = texture->backing();
if (backing) {
if (backing->resourceHasBeenDeleted()) {
DCHECK(std::find(m_backings.begin(), m_backings.end(), backing) == m_backings.end());
@@ -456,9 +456,9 @@ void PrioritizedTextureManager::assertInvariants()
// backings that can't be evicted in the backing texture list (otherwise
// reduceMemory will not find all textures available for eviction/recycling).
bool reachedUnrecyclable = false;
- PrioritizedTexture::Backing* previous_backing = NULL;
+ PrioritizedResource::Backing* previous_backing = NULL;
for (BackingList::iterator it = m_backings.begin(); it != m_backings.end(); ++it) {
- PrioritizedTexture::Backing* backing = *it;
+ PrioritizedResource::Backing* backing = *it;
if (previous_backing && (!m_backingsTailNotSorted || !backing->wasAbovePriorityCutoffAtLastPriorityUpdate()))
DCHECK(compareBackings(previous_backing, backing));
if (!backing->canBeRecycled())
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_resource_manager.h
index 0bb0bac..929f72f 100644
--- a/cc/prioritized_texture_manager.h
+++ b/cc/prioritized_resource_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_PRIORITIZED_TEXTURE_MANAGER_H_
-#define CC_PRIORITIZED_TEXTURE_MANAGER_H_
+#ifndef CC_PRIORITIZED_RESOURCE_MANAGER_H_
+#define CC_PRIORITIZED_RESOURCE_MANAGER_H_
#include <list>
#include <vector>
@@ -12,7 +12,7 @@
#include "base/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "cc/cc_export.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/priority_calculator.h"
#include "cc/texture.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -21,8 +21,8 @@
#if defined(COMPILER_GCC)
namespace BASE_HASH_NAMESPACE {
template<>
-struct hash<cc::PrioritizedTexture*> {
- size_t operator()(cc::PrioritizedTexture* ptr) const {
+struct hash<cc::PrioritizedResource*> {
+ size_t operator()(cc::PrioritizedResource* ptr) const {
return hash<size_t>()(reinterpret_cast<size_t>(ptr));
}
};
@@ -33,19 +33,19 @@ namespace cc {
class PriorityCalculator;
-class CC_EXPORT PrioritizedTextureManager {
+class CC_EXPORT PrioritizedResourceManager {
public:
- static scoped_ptr<PrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool)
+ static scoped_ptr<PrioritizedResourceManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool)
{
- return make_scoped_ptr(new PrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool));
+ return make_scoped_ptr(new PrioritizedResourceManager(maxMemoryLimitBytes, maxTextureSize, pool));
}
- scoped_ptr<PrioritizedTexture> createTexture(gfx::Size size, GLenum format)
+ scoped_ptr<PrioritizedResource> createTexture(gfx::Size size, GLenum format)
{
- return make_scoped_ptr(new PrioritizedTexture(this, size, format));
+ return make_scoped_ptr(new PrioritizedResource(this, size, format));
}
- ~PrioritizedTextureManager();
+ ~PrioritizedResourceManager();
- typedef std::list<PrioritizedTexture::Backing*> BackingList;
+ typedef std::list<PrioritizedResource::Backing*> BackingList;
// FIXME (http://crbug.com/137094): This 64MB default is a straggler from the
// old texture manager and is just to give us a default memory allocation before
@@ -91,16 +91,16 @@ public:
// before updating layers.
void unlinkEvictedBackings(const BackingList& evictedBackings);
- bool requestLate(PrioritizedTexture*);
+ bool requestLate(PrioritizedResource*);
void reduceMemory(ResourceProvider*);
void clearAllMemory(ResourceProvider*);
- void acquireBackingTextureIfNeeded(PrioritizedTexture*, ResourceProvider*);
+ void acquireBackingTextureIfNeeded(PrioritizedResource*, ResourceProvider*);
- void registerTexture(PrioritizedTexture*);
- void unregisterTexture(PrioritizedTexture*);
- void returnBackingTexture(PrioritizedTexture*);
+ void registerTexture(PrioritizedResource*);
+ void unregisterTexture(PrioritizedResource*);
+ void returnBackingTexture(PrioritizedResource*);
// Update all backings' priorities from their owning texture.
void pushTexturePrioritiesToBackings();
@@ -109,7 +109,7 @@ public:
void updateBackingsInDrawingImplTree();
private:
- friend class PrioritizedTextureTest;
+ friend class PrioritizedResourceTest;
enum EvictionPolicy {
EvictOnlyRecyclable,
@@ -117,14 +117,14 @@ private:
};
// Compare textures. Highest priority first.
- static inline bool compareTextures(PrioritizedTexture* a, PrioritizedTexture* b)
+ static inline bool compareTextures(PrioritizedResource* a, PrioritizedResource* b)
{
if (a->requestPriority() == b->requestPriority())
return a < b;
return PriorityCalculator::priorityIsHigher(a->requestPriority(), b->requestPriority());
}
// Compare backings. Lowest priority first.
- static inline bool compareBackings(PrioritizedTexture::Backing* a, PrioritizedTexture::Backing* b)
+ static inline bool compareBackings(PrioritizedResource::Backing* a, PrioritizedResource::Backing* b)
{
// Make textures that can be recycled appear first
if (a->canBeRecycled() != b->canBeRecycled())
@@ -142,10 +142,10 @@ private:
return a < b;
}
- PrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
+ PrioritizedResourceManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, EvictionPolicy, ResourceProvider*);
- PrioritizedTexture::Backing* createBacking(gfx::Size, GLenum format, ResourceProvider*);
+ PrioritizedResource::Backing* createBacking(gfx::Size, GLenum format, ResourceProvider*);
void evictFirstBackingResource(ResourceProvider*);
void deleteUnlinkedEvictedBackings();
void sortBackings();
@@ -165,8 +165,8 @@ private:
size_t m_memoryAvailableBytes;
int m_pool;
- typedef base::hash_set<PrioritizedTexture*> TextureSet;
- typedef std::vector<PrioritizedTexture*> TextureVector;
+ typedef base::hash_set<PrioritizedResource*> TextureSet;
+ typedef std::vector<PrioritizedResource*> TextureVector;
TextureSet m_textures;
// This list is always sorted in eviction order, with the exception the
@@ -186,9 +186,9 @@ private:
size_t m_memoryVisibleLastPushedBytes;
size_t m_memoryVisibleAndNearbyLastPushedBytes;
- DISALLOW_COPY_AND_ASSIGN(PrioritizedTextureManager);
+ DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager);
};
} // namespace cc
-#endif // CC_PRIORITIZED_TEXTURE_MANAGER_H_
+#endif // CC_PRIORITIZED_RESOURCE_MANAGER_H_
diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_resource_unittest.cc
index 181fb86..328d92c 100644
--- a/cc/prioritized_texture_unittest.cc
+++ b/cc/prioritized_resource_unittest.cc
@@ -4,9 +4,9 @@
#include "config.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
-#include "cc/prioritized_texture_manager.h"
+#include "cc/prioritized_resource_manager.h"
#include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
#include "cc/test/fake_graphics_context.h"
#include "cc/test/tiled_layer_test_common.h"
@@ -18,9 +18,9 @@ using namespace WebKitTests;
namespace cc {
-class PrioritizedTextureTest : public testing::Test {
+class PrioritizedResourceTest : public testing::Test {
public:
- PrioritizedTextureTest()
+ PrioritizedResourceTest()
: m_textureSize(256, 256)
, m_textureFormat(GL_RGBA)
, m_context(WebKit::createFakeGraphicsContext())
@@ -29,7 +29,7 @@ public:
m_resourceProvider = ResourceProvider::create(m_context.get());
}
- virtual ~PrioritizedTextureTest()
+ virtual ~PrioritizedResourceTest()
{
DebugScopedSetImplThread implThread;
m_resourceProvider.reset();
@@ -40,17 +40,17 @@ public:
return Texture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount;
}
- scoped_ptr<PrioritizedTextureManager> createManager(size_t maxTextures)
+ scoped_ptr<PrioritizedResourceManager> createManager(size_t maxTextures)
{
- return PrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0);
+ return PrioritizedResourceManager::create(texturesMemorySize(maxTextures), 1024, 0);
}
- bool validateTexture(scoped_ptr<PrioritizedTexture>& texture, bool requestLate)
+ bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestLate)
{
- textureManagerAssertInvariants(texture->textureManager());
+ resourceManagerAssertInvariants(texture->resourceManager());
if (requestLate)
texture->requestLate();
- textureManagerAssertInvariants(texture->textureManager());
+ resourceManagerAssertInvariants(texture->resourceManager());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
bool success = texture->canAcquireBackingTexture();
if (success)
@@ -58,16 +58,16 @@ public:
return success;
}
- void prioritizeTexturesAndBackings(PrioritizedTextureManager* textureManager)
+ void prioritizeTexturesAndBackings(PrioritizedResourceManager* resourceManager)
{
- textureManager->prioritizeTextures();
- textureManagerUpdateBackingsPriorities(textureManager);
+ resourceManager->prioritizeTextures();
+ resourceManagerUpdateBackingsPriorities(resourceManager);
}
- void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textureManager)
+ void resourceManagerUpdateBackingsPriorities(PrioritizedResourceManager* resourceManager)
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->pushTexturePrioritiesToBackings();
+ resourceManager->pushTexturePrioritiesToBackings();
}
ResourceProvider* resourceProvider()
@@ -75,15 +75,15 @@ public:
return m_resourceProvider.get();
}
- void textureManagerAssertInvariants(PrioritizedTextureManager* textureManager)
+ void resourceManagerAssertInvariants(PrioritizedResourceManager* resourceManager)
{
#ifndef NDEBUG
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->assertInvariants();
+ resourceManager->assertInvariants();
#endif
}
- bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture)
+ bool textureBackingIsAbovePriorityCutoff(PrioritizedResource* texture)
{
return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate();
}
@@ -99,23 +99,23 @@ protected:
namespace {
-TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit)
+TEST_F(PrioritizedResourceTest, requestTextureExceedingMaxLimit)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
// Create textures for double our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures*2];
+ scoped_ptr<PrioritizedResource> textures[maxTextures*2];
for (size_t i = 0; i < maxTextures*2; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set decreasing priorities
for (size_t i = 0; i < maxTextures*2; ++i)
textures[i]->setRequestPriority(100 + i);
// Only lower half should be available.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
EXPECT_TRUE(validateTexture(textures[0], false));
EXPECT_TRUE(validateTexture(textures[7], false));
EXPECT_FALSE(validateTexture(textures[8], false));
@@ -126,154 +126,154 @@ TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit)
textures[i]->setRequestPriority(100 - i);
// Only upper half should be available.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
EXPECT_FALSE(validateTexture(textures[0], false));
EXPECT_FALSE(validateTexture(textures[7], false));
EXPECT_TRUE(validateTexture(textures[8], false));
EXPECT_TRUE(validateTexture(textures[15], false));
- EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(maxTextures), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, changeMemoryLimits)
+TEST_F(PrioritizedResourceTest, changeMemoryLimits)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100 + i);
// Set max limit to 8 textures
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
validateTexture(textures[i], false);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(8), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
// Set max limit to 5 textures
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(5));
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
EXPECT_EQ(validateTexture(textures[i], false), i < 5);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(5), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(5), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
// Set max limit to 4 textures
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(4));
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
EXPECT_EQ(validateTexture(textures[i], false), i < 4);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, changePriorityCutoff)
+TEST_F(PrioritizedResourceTest, changePriorityCutoff)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100 + i);
// Set the cutoff to drop two textures. Try to requestLate on all textures, and
// make sure that requestLate doesn't work on a texture with equal priority to
// the cutoff.
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
- textureManager->setExternalPriorityCutoff(106);
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
+ resourceManager->setExternalPriorityCutoff(106);
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
EXPECT_EQ(validateTexture(textures[i], true), i < 6);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(6), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
// Set the cutoff to drop two more textures.
- textureManager->setExternalPriorityCutoff(104);
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setExternalPriorityCutoff(104);
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
EXPECT_EQ(validateTexture(textures[i], false), i < 4);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryAboveCutoffBytes());
// Do a one-time eviction for one more texture based on priority cutoff
- PrioritizedTextureManager::BackingList evictedBackings;
+ PrioritizedResourceManager::BackingList evictedBackings;
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 104, resourceProvider());
- textureManager->getEvictedBackings(evictedBackings);
+ resourceManager->reduceMemoryOnImplThread(texturesMemorySize(8), 104, resourceProvider());
+ resourceManager->getEvictedBackings(evictedBackings);
EXPECT_EQ(0, evictedBackings.size());
- textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 103, resourceProvider());
- textureManager->getEvictedBackings(evictedBackings);
+ resourceManager->reduceMemoryOnImplThread(texturesMemorySize(8), 103, resourceProvider());
+ resourceManager->getEvictedBackings(evictedBackings);
EXPECT_EQ(1, evictedBackings.size());
}
- textureManager->unlinkEvictedBackings(evictedBackings);
- EXPECT_EQ(texturesMemorySize(3), textureManager->memoryUseBytes());
+ resourceManager->unlinkEvictedBackings(evictedBackings);
+ EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryUseBytes());
// Re-allocate the the texture after the one-time drop.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
for (size_t i = 0; i < maxTextures; ++i)
EXPECT_EQ(validateTexture(textures[i], false), i < 4);
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->reduceMemory(resourceProvider());
+ resourceManager->reduceMemory(resourceProvider());
}
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures)
+TEST_F(PrioritizedResourceTest, resourceManagerPartialUpdateTextures)
{
const size_t maxTextures = 4;
const size_t numTextures = 4;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- scoped_ptr<PrioritizedTexture> textures[numTextures];
- scoped_ptr<PrioritizedTexture> moreTextures[numTextures];
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResource> textures[numTextures];
+ scoped_ptr<PrioritizedResource> moreTextures[numTextures];
for (size_t i = 0; i < numTextures; ++i) {
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
- moreTextures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
+ moreTextures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
}
for (size_t i = 0; i < numTextures; ++i)
textures[i]->setRequestPriority(200 + i);
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
// Allocate textures which are currently high priority.
EXPECT_TRUE(validateTexture(textures[0], false));
@@ -288,7 +288,7 @@ TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures)
for (size_t i = 0; i < numTextures; ++i)
moreTextures[i]->setRequestPriority(100 + i);
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
// Textures are now below cutoff.
EXPECT_FALSE(validateTexture(textures[0], false));
@@ -315,17 +315,17 @@ TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures)
EXPECT_FALSE(textures[3]->haveBackingTexture());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual)
+TEST_F(PrioritizedResourceTest, resourceManagerPrioritiesAreEqual)
{
const size_t maxTextures = 16;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// All 16 textures have the same priority except 2 higher priority.
for (size_t i = 0; i < maxTextures; ++i)
@@ -334,16 +334,16 @@ TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual)
textures[1]->setRequestPriority(99);
// Set max limit to 8 textures
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(8));
+ prioritizeTexturesAndBackings(resourceManager.get());
// The two high priority textures should be available, others should not.
for (size_t i = 0; i < 2; ++i)
EXPECT_TRUE(validateTexture(textures[i], false));
for (size_t i = 2; i < maxTextures; ++i)
EXPECT_FALSE(validateTexture(textures[i], false));
- EXPECT_EQ(texturesMemorySize(2), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(2), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
// Manually reserving textures should only succeed on the higher priority textures,
// and on remaining textures up to the memory limit.
@@ -351,23 +351,23 @@ TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual)
EXPECT_TRUE(validateTexture(textures[i], true));
for (size_t i = 9; i < maxTextures; i++)
EXPECT_FALSE(validateTexture(textures[i], true));
- EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(8), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst)
+TEST_F(PrioritizedResourceTest, resourceManagerDestroyedFirst)
{
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(1);
- scoped_ptr<PrioritizedTexture> texture = textureManager->createTexture(m_textureSize, m_textureFormat);
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(1);
+ scoped_ptr<PrioritizedResource> texture = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Texture is initially invalid, but it will become available.
EXPECT_FALSE(texture->haveBackingTexture());
texture->setRequestPriority(100);
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
EXPECT_TRUE(validateTexture(texture, false));
EXPECT_TRUE(texture->canAcquireBackingTexture());
@@ -375,25 +375,25 @@ TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst)
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
- textureManager.reset();
+ resourceManager.reset();
EXPECT_FALSE(texture->canAcquireBackingTexture());
EXPECT_FALSE(texture->haveBackingTexture());
}
-TEST_F(PrioritizedTextureTest, textureMovedToNewManager)
+TEST_F(PrioritizedResourceTest, textureMovedToNewManager)
{
- scoped_ptr<PrioritizedTextureManager> textureManagerOne = createManager(1);
- scoped_ptr<PrioritizedTextureManager> textureManagerTwo = createManager(1);
- scoped_ptr<PrioritizedTexture> texture = textureManagerOne->createTexture(m_textureSize, m_textureFormat);
+ scoped_ptr<PrioritizedResourceManager> resourceManagerOne = createManager(1);
+ scoped_ptr<PrioritizedResourceManager> resourceManagerTwo = createManager(1);
+ scoped_ptr<PrioritizedResource> texture = resourceManagerOne->createTexture(m_textureSize, m_textureFormat);
// Texture is initially invalid, but it will become available.
EXPECT_FALSE(texture->haveBackingTexture());
texture->setRequestPriority(100);
- prioritizeTexturesAndBackings(textureManagerOne.get());
+ prioritizeTexturesAndBackings(resourceManagerOne.get());
EXPECT_TRUE(validateTexture(texture, false));
EXPECT_TRUE(texture->canAcquireBackingTexture());
@@ -403,47 +403,47 @@ TEST_F(PrioritizedTextureTest, textureMovedToNewManager)
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManagerOne->clearAllMemory(resourceProvider());
+ resourceManagerOne->clearAllMemory(resourceProvider());
}
- textureManagerOne.reset();
+ resourceManagerOne.reset();
EXPECT_FALSE(texture->canAcquireBackingTexture());
EXPECT_FALSE(texture->haveBackingTexture());
- texture->setTextureManager(textureManagerTwo.get());
+ texture->setTextureManager(resourceManagerTwo.get());
- prioritizeTexturesAndBackings(textureManagerTwo.get());
+ prioritizeTexturesAndBackings(resourceManagerTwo.get());
EXPECT_TRUE(validateTexture(texture, false));
EXPECT_TRUE(texture->canAcquireBackingTexture());
EXPECT_TRUE(texture->haveBackingTexture());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManagerTwo->clearAllMemory(resourceProvider());
+ resourceManagerTwo->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSurface)
+TEST_F(PrioritizedResourceTest, renderSurfacesReduceMemoryAvailableOutsideRootSurface)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
// Half of the memory is taken by surfaces (with high priority place-holder)
- scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat);
+ scoped_ptr<PrioritizedResource> renderSurfacePlaceHolder = resourceManager->createTexture(m_textureSize, m_textureFormat);
renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4));
renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority());
// Create textures to fill our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set decreasing non-visible priorities outside root surface.
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100 + i);
// Only lower half should be available.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
EXPECT_TRUE(validateTexture(textures[0], false));
EXPECT_TRUE(validateTexture(textures[3], false));
EXPECT_FALSE(validateTexture(textures[4], false));
@@ -454,42 +454,42 @@ TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSur
textures[i]->setRequestPriority(100 - i);
// Only upper half should be available.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
EXPECT_FALSE(validateTexture(textures[0], false));
EXPECT_FALSE(validateTexture(textures[3], false));
EXPECT_TRUE(validateTexture(textures[4], false));
EXPECT_TRUE(validateTexture(textures[7], false));
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryForSelfManagedTextures());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate)
+TEST_F(PrioritizedResourceTest, renderSurfacesReduceMemoryAvailableForRequestLate)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
// Half of the memory is taken by surfaces (with high priority place-holder)
- scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat);
+ scoped_ptr<PrioritizedResource> renderSurfacePlaceHolder = resourceManager->createTexture(m_textureSize, m_textureFormat);
renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4));
renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority());
// Create textures to fill our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set equal priorities.
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100);
// The first four to be requested late will be available.
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
for (unsigned i = 0; i < maxTextures; ++i)
EXPECT_FALSE(validateTexture(textures[i], false));
for (unsigned i = 0; i < maxTextures; i += 2)
@@ -497,29 +497,29 @@ TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate
for (unsigned i = 1; i < maxTextures; i += 2)
EXPECT_FALSE(validateTexture(textures[i], true));
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryForSelfManagedTextures());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable)
+TEST_F(PrioritizedResourceTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
// Half of the memory is taken by surfaces (with high priority place-holder)
- scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat);
+ scoped_ptr<PrioritizedResource> renderSurfacePlaceHolder = resourceManager->createTexture(m_textureSize, m_textureFormat);
renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4));
renderSurfacePlaceHolder->setRequestPriority(PriorityCalculator::renderSurfacePriority());
// Create textures to fill our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set 6 visible textures in the root surface, and 2 in a child surface.
for (size_t i = 0; i < 6; ++i)
@@ -527,7 +527,7 @@ TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvail
for (size_t i = 6; i < 8; ++i)
textures[i]->setRequestPriority(PriorityCalculator::visiblePriority(false));
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
// Unable to requestLate textures in the child surface.
EXPECT_FALSE(validateTexture(textures[6], true));
@@ -537,47 +537,47 @@ TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvail
for (size_t i = 0; i < 6; ++i)
EXPECT_TRUE(validateTexture(textures[i], false));
- EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes());
- EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures());
- EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(6), resourceManager->memoryAboveCutoffBytes());
+ EXPECT_EQ(texturesMemorySize(2), resourceManager->memoryForSelfManagedTextures());
+ EXPECT_LE(resourceManager->memoryUseBytes(), resourceManager->memoryAboveCutoffBytes());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, requestLateBackingsSorting)
+TEST_F(PrioritizedResourceTest, requestLateBackingsSorting)
{
const size_t maxTextures = 8;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures));
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures));
// Create textures to fill our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set equal priorities, and allocate backings for all textures.
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100);
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
for (unsigned i = 0; i < maxTextures; ++i)
EXPECT_TRUE(validateTexture(textures[i], false));
// Drop the memory limit and prioritize (none will be above the threshold,
// but they still have backings because reduceMemory hasn't been called).
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures / 2));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures / 2));
+ prioritizeTexturesAndBackings(resourceManager.get());
// Push half of them back over the limit.
for (size_t i = 0; i < maxTextures; i += 2)
EXPECT_TRUE(textures[i]->requestLate());
// Push the priorities to the backings array and sort the backings array
- textureManagerUpdateBackingsPriorities(textureManager.get());
+ resourceManagerUpdateBackingsPriorities(resourceManager.get());
// Assert that the backings list be sorted with the below-limit backings
// before the above-limit backings.
- textureManagerAssertInvariants(textureManager.get());
+ resourceManagerAssertInvariants(resourceManager.get());
// Make sure that we have backings for all of the textures.
for (size_t i = 0; i < maxTextures; ++i)
@@ -590,26 +590,26 @@ TEST_F(PrioritizedTextureTest, requestLateBackingsSorting)
EXPECT_FALSE(textureBackingIsAbovePriorityCutoff(textures[i].get()));
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
-TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources)
+TEST_F(PrioritizedResourceTest, clearUploadsToEvictedResources)
{
const size_t maxTextures = 4;
- scoped_ptr<PrioritizedTextureManager> textureManager =
+ scoped_ptr<PrioritizedResourceManager> resourceManager =
createManager(maxTextures);
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures));
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures));
// Create textures to fill our memory limit.
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
// Set equal priorities, and allocate backings for all textures.
for (size_t i = 0; i < maxTextures; ++i)
textures[i]->setRequestPriority(100);
- prioritizeTexturesAndBackings(textureManager.get());
+ prioritizeTexturesAndBackings(resourceManager.get());
for (unsigned i = 0; i < maxTextures; ++i)
EXPECT_TRUE(validateTexture(textures[i], false));
@@ -628,25 +628,25 @@ TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources)
queue.clearUploadsToEvictedResources();
EXPECT_EQ(4, queue.fullUploadSize());
- textureManager->reduceMemoryOnImplThread(
+ resourceManager->reduceMemoryOnImplThread(
texturesMemorySize(1), PriorityCalculator::allowEverythingCutoff(), resourceProvider());
queue.clearUploadsToEvictedResources();
EXPECT_EQ(1, queue.fullUploadSize());
- textureManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEverythingCutoff(), resourceProvider());
+ resourceManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEverythingCutoff(), resourceProvider());
queue.clearUploadsToEvictedResources();
EXPECT_EQ(0, queue.fullUploadSize());
}
-TEST_F(PrioritizedTextureTest, usageStatistics)
+TEST_F(PrioritizedResourceTest, usageStatistics)
{
const size_t maxTextures = 5;
- scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxTextures);
- scoped_ptr<PrioritizedTexture> textures[maxTextures];
+ scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTextures);
+ scoped_ptr<PrioritizedResource> textures[maxTextures];
for (size_t i = 0; i < maxTextures; ++i)
- textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat);
+ textures[i] = resourceManager->createTexture(m_textureSize, m_textureFormat);
textures[0]->setRequestPriority(PriorityCalculator::allowVisibleOnlyCutoff() - 1);
textures[1]->setRequestPriority(PriorityCalculator::allowVisibleOnlyCutoff());
@@ -655,8 +655,8 @@ TEST_F(PrioritizedTextureTest, usageStatistics)
textures[4]->setRequestPriority(PriorityCalculator::allowVisibleAndNearbyCutoff() + 1);
// Set max limit to 2 textures.
- textureManager->setMaxMemoryLimitBytes(texturesMemorySize(2));
- prioritizeTexturesAndBackings(textureManager.get());
+ resourceManager->setMaxMemoryLimitBytes(texturesMemorySize(2));
+ prioritizeTexturesAndBackings(resourceManager.get());
// The first two textures should be available, others should not.
for (size_t i = 0; i < 2; ++i)
@@ -667,9 +667,9 @@ TEST_F(PrioritizedTextureTest, usageStatistics)
// Validate the statistics.
{
DebugScopedSetImplThread implThread;
- EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
- EXPECT_EQ(texturesMemorySize(1), textureManager->memoryVisibleBytes());
- EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleAndNearbyBytes());
+ EXPECT_EQ(texturesMemorySize(2), resourceManager->memoryUseBytes());
+ EXPECT_EQ(texturesMemorySize(1), resourceManager->memoryVisibleBytes());
+ EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleAndNearbyBytes());
}
// Re-prioritize the textures, but do not push the values to backings.
@@ -678,27 +678,27 @@ TEST_F(PrioritizedTextureTest, usageStatistics)
textures[2]->setRequestPriority(PriorityCalculator::allowVisibleOnlyCutoff() - 1);
textures[3]->setRequestPriority(PriorityCalculator::allowVisibleAndNearbyCutoff() - 1);
textures[4]->setRequestPriority(PriorityCalculator::allowVisibleAndNearbyCutoff());
- textureManager->prioritizeTextures();
+ resourceManager->prioritizeTextures();
// Verify that we still see the old values.
{
DebugScopedSetImplThread implThread;
- EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
- EXPECT_EQ(texturesMemorySize(1), textureManager->memoryVisibleBytes());
- EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleAndNearbyBytes());
+ EXPECT_EQ(texturesMemorySize(2), resourceManager->memoryUseBytes());
+ EXPECT_EQ(texturesMemorySize(1), resourceManager->memoryVisibleBytes());
+ EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleAndNearbyBytes());
}
// Push priorities to backings, and verify we see the new values.
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->pushTexturePrioritiesToBackings();
- EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
- EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleBytes());
- EXPECT_EQ(texturesMemorySize(4), textureManager->memoryVisibleAndNearbyBytes());
+ resourceManager->pushTexturePrioritiesToBackings();
+ EXPECT_EQ(texturesMemorySize(2), resourceManager->memoryUseBytes());
+ EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes());
+ EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearbyBytes());
}
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider());
+ resourceManager->clearAllMemory(resourceProvider());
}
diff --git a/cc/resource_update.cc b/cc/resource_update.cc
index b50e36c..6f224a9 100644
--- a/cc/resource_update.cc
+++ b/cc/resource_update.cc
@@ -10,7 +10,7 @@
namespace cc {
-ResourceUpdate ResourceUpdate::Create(PrioritizedTexture* texture,
+ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture,
const SkBitmap* bitmap,
gfx::Rect content_rect,
gfx::Rect source_rect,
@@ -25,7 +25,7 @@ ResourceUpdate ResourceUpdate::Create(PrioritizedTexture* texture,
return update;
}
-ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedTexture* texture,
+ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedResource* texture,
SkPicture* picture,
gfx::Rect content_rect,
gfx::Rect source_rect,
diff --git a/cc/resource_update.h b/cc/resource_update.h
index 94b7739..2f8a6f0 100644
--- a/cc/resource_update.h
+++ b/cc/resource_update.h
@@ -14,15 +14,15 @@ class SkPicture;
namespace cc {
-class PrioritizedTexture;
+class PrioritizedResource;
struct CC_EXPORT ResourceUpdate {
- static ResourceUpdate Create(PrioritizedTexture*,
+ static ResourceUpdate Create(PrioritizedResource*,
const SkBitmap*,
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset);
- static ResourceUpdate CreateFromPicture(PrioritizedTexture*,
+ static ResourceUpdate CreateFromPicture(PrioritizedResource*,
SkPicture*,
gfx::Rect content_rect,
gfx::Rect source_rect,
@@ -31,7 +31,7 @@ struct CC_EXPORT ResourceUpdate {
ResourceUpdate();
virtual ~ResourceUpdate();
- PrioritizedTexture* texture;
+ PrioritizedResource* texture;
const SkBitmap* bitmap;
SkPicture* picture;
gfx::Rect content_rect;
diff --git a/cc/resource_update_controller.cc b/cc/resource_update_controller.cc
index 557fb47..7c1f56c 100644
--- a/cc/resource_update_controller.cc
+++ b/cc/resource_update_controller.cc
@@ -7,7 +7,7 @@
#include "cc/resource_update_controller.h"
#include "base/debug/trace_event.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/proxy.h"
#include "cc/resource_provider.h"
#include "cc/texture_copier.h"
@@ -122,7 +122,7 @@ void ResourceUpdateController::discardUploadsToEvictedResources()
void ResourceUpdateController::updateTexture(ResourceUpdate update)
{
if (update.picture) {
- PrioritizedTexture* texture = update.texture;
+ PrioritizedResource* texture = update.texture;
gfx::Rect pictureRect = update.content_rect;
gfx::Rect sourceRect = update.source_rect;
gfx::Vector2d destOffset = update.dest_offset;
diff --git a/cc/resource_update_controller_unittest.cc b/cc/resource_update_controller_unittest.cc
index 7d68629..cf58a11 100644
--- a/cc/resource_update_controller_unittest.cc
+++ b/cc/resource_update_controller_unittest.cc
@@ -65,7 +65,7 @@ class ResourceUpdateControllerTest : public Test {
public:
ResourceUpdateControllerTest()
: m_queue(make_scoped_ptr(new ResourceUpdateQueue))
- , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool))
+ , m_resourceManager(PrioritizedResourceManager::create(60*1024*1024, 1024, Renderer::ContentPool))
, m_fullUploadCountExpected(0)
, m_partialCountExpected(0)
, m_totalUploadCountExpected(0)
@@ -82,7 +82,7 @@ public:
{
DebugScopedSetImplThreadAndMainThreadBlocked
implThreadAndMainThreadBlocked;
- m_textureManager->clearAllMemory(m_resourceProvider.get());
+ m_resourceManager->clearAllMemory(m_resourceProvider.get());
}
public:
@@ -126,12 +126,12 @@ protected:
m_bitmap.allocPixels();
for (int i = 0; i < 4; i++) {
- m_textures[i] = PrioritizedTexture::create(
- m_textureManager.get(), gfx::Size(300, 150), GL_RGBA);
+ m_textures[i] = PrioritizedResource::create(
+ m_resourceManager.get(), gfx::Size(300, 150), GL_RGBA);
m_textures[i]->setRequestPriority(
PriorityCalculator::visiblePriority(true));
}
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
DebugScopedSetImplThread implThread;
m_resourceProvider = ResourceProvider::create(m_context.get());
@@ -200,8 +200,8 @@ protected:
scoped_ptr<GraphicsContext> m_context;
scoped_ptr<ResourceProvider> m_resourceProvider;
scoped_ptr<ResourceUpdateQueue> m_queue;
- scoped_ptr<PrioritizedTexture> m_textures[4];
- scoped_ptr<PrioritizedTextureManager> m_textureManager;
+ scoped_ptr<PrioritizedResource> m_textures[4];
+ scoped_ptr<PrioritizedResourceManager> m_resourceManager;
SkBitmap m_bitmap;
int m_queryResultsAvailable;
diff --git a/cc/resource_update_queue.cc b/cc/resource_update_queue.cc
index e1cac2a..367a4116 100644
--- a/cc/resource_update_queue.cc
+++ b/cc/resource_update_queue.cc
@@ -6,7 +6,7 @@
#include "cc/resource_update_queue.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
namespace cc {
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 64b406b..8b49781 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -337,7 +337,7 @@ bool SingleThreadProxy::commitAndComposite()
return false;
// Unlink any texture backings that were deleted
- PrioritizedTextureManager::BackingList evictedContentsTexturesBackings;
+ PrioritizedResourceManager::BackingList evictedContentsTexturesBackings;
{
DebugScopedSetImplThread implThread;
m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedContentsTexturesBackings);
diff --git a/cc/skpicture_content_layer_updater.cc b/cc/skpicture_content_layer_updater.cc
index 7e049ec..8897f24 100644
--- a/cc/skpicture_content_layer_updater.cc
+++ b/cc/skpicture_content_layer_updater.cc
@@ -13,7 +13,7 @@
namespace cc {
-SkPictureContentLayerUpdater::Resource::Resource(SkPictureContentLayerUpdater* updater, scoped_ptr<PrioritizedTexture> texture)
+SkPictureContentLayerUpdater::Resource::Resource(SkPictureContentLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture)
: LayerUpdater::Resource(texture.Pass())
, m_updater(updater)
{
@@ -43,9 +43,9 @@ scoped_refptr<SkPictureContentLayerUpdater> SkPictureContentLayerUpdater::create
return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass()));
}
-scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::createResource(PrioritizedTextureManager* manager)
+scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
+ return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
void SkPictureContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats& stats)
@@ -61,7 +61,7 @@ void SkPictureContentLayerUpdater::drawPicture(SkCanvas* canvas)
canvas->drawPicture(m_picture);
}
-void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
+void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
ResourceUpdate upload = ResourceUpdate::CreateFromPicture(
texture, &m_picture, contentRect(), sourceRect, destOffset);
diff --git a/cc/skpicture_content_layer_updater.h b/cc/skpicture_content_layer_updater.h
index 6a05972..cc2d86c 100644
--- a/cc/skpicture_content_layer_updater.h
+++ b/cc/skpicture_content_layer_updater.h
@@ -24,7 +24,7 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater {
public:
class Resource : public LayerUpdater::Resource {
public:
- Resource(SkPictureContentLayerUpdater*, scoped_ptr<PrioritizedTexture>);
+ Resource(SkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
virtual ~Resource();
virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
@@ -37,7 +37,7 @@ public:
static scoped_refptr<SkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTextureManager*) OVERRIDE;
+ virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
virtual void setOpaque(bool) OVERRIDE;
protected:
@@ -46,7 +46,7 @@ protected:
virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
void drawPicture(SkCanvas*);
- void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
+ void updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
bool layerIsOpaque() const { return m_layerIsOpaque; }
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 6ed95ca..12172f1 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -10,7 +10,7 @@ using namespace cc;
namespace WebKitTests {
-FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<PrioritizedTexture> texture)
+FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<PrioritizedResource> texture)
: LayerUpdater::Resource(texture.Pass())
, m_layer(layer)
{
@@ -63,9 +63,9 @@ void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer
m_layer = layer;
}
-scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedTextureManager* manager)
+scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedResourceManager* manager)
{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
+ return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
FakeTiledLayerImpl::FakeTiledLayerImpl(int id)
@@ -77,10 +77,10 @@ FakeTiledLayerImpl::~FakeTiledLayerImpl()
{
}
-FakeTiledLayer::FakeTiledLayer(PrioritizedTextureManager* textureManager)
+FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resourceManager)
: TiledLayer()
, m_fakeUpdater(make_scoped_refptr(new FakeLayerUpdater))
- , m_textureManager(textureManager)
+ , m_resourceManager(resourceManager)
{
setTileSize(tileSize());
setTextureFormat(GL_RGBA);
@@ -88,8 +88,8 @@ FakeTiledLayer::FakeTiledLayer(PrioritizedTextureManager* textureManager)
setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons.
}
-FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedTextureManager* textureManager)
- : FakeTiledLayer(textureManager)
+FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedResourceManager* resourceManager)
+ : FakeTiledLayer(resourceManager)
{
}
@@ -124,9 +124,9 @@ void FakeTiledLayer::setTexturePriorities(const PriorityCalculator& calculator)
}
}
-cc::PrioritizedTextureManager* FakeTiledLayer::textureManager() const
+cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const
{
- return m_textureManager;
+ return m_resourceManager;
}
cc::LayerUpdater* FakeTiledLayer::updater() const
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 2b0f13b..2a8875b 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -7,7 +7,7 @@
#include "Region.h"
#include "cc/layer_updater.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/resource_provider.h"
#include "cc/resource_update_queue.h"
#include "cc/texture_copier.h"
@@ -25,7 +25,7 @@ class FakeLayerUpdater : public cc::LayerUpdater {
public:
class Resource : public cc::LayerUpdater::Resource {
public:
- Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedTexture>);
+ Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedResource>);
virtual ~Resource();
virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gfx::Vector2d&, bool, cc::RenderingStats&) OVERRIDE;
@@ -37,7 +37,7 @@ public:
FakeLayerUpdater();
- virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::PrioritizedTextureManager*) OVERRIDE;
+ virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::PrioritizedResourceManager*) OVERRIDE;
virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE;
// Sets the rect to invalidate during the next call to prepareToUpdate(). After the next
@@ -80,7 +80,7 @@ public:
class FakeTiledLayer : public cc::TiledLayer {
public:
- explicit FakeTiledLayer(cc::PrioritizedTextureManager*);
+ explicit FakeTiledLayer(cc::PrioritizedResourceManager*);
static gfx::Size tileSize() { return gfx::Size(100, 100); }
@@ -95,7 +95,7 @@ public:
virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE;
- virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE;
+ virtual cc::PrioritizedResourceManager* resourceManager() const OVERRIDE;
FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); }
gfx::RectF updateRect() { return m_updateRect; }
@@ -106,13 +106,13 @@ protected:
private:
scoped_refptr<FakeLayerUpdater> m_fakeUpdater;
- cc::PrioritizedTextureManager* m_textureManager;
+ cc::PrioritizedResourceManager* m_resourceManager;
gfx::RectF m_lastNeedsDisplayRect;
};
class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
public:
- explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*);
+ explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedResourceManager*);
void setContentBounds(const gfx::Size& contentBounds) { m_forcedContentBounds = contentBounds; }
virtual gfx::Size contentBounds() const OVERRIDE;
diff --git a/cc/texture_uploader.cc b/cc/texture_uploader.cc
index 28decb8..078c08e 100644
--- a/cc/texture_uploader.cc
+++ b/cc/texture_uploader.cc
@@ -13,7 +13,7 @@
#include "base/debug/trace_event.h"
#include "base/metrics/histogram.h"
#include "cc/texture.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
#include "ui/gfx/rect.h"
diff --git a/cc/texture_uploader_unittest.cc b/cc/texture_uploader_unittest.cc
index 97ef5ec..f9cf31f 100644
--- a/cc/texture_uploader_unittest.cc
+++ b/cc/texture_uploader_unittest.cc
@@ -6,7 +6,7 @@
#include "cc/texture_uploader.h"
-#include "cc/prioritized_texture.h"
+#include "cc/prioritized_resource.h"
#include "cc/test/fake_web_graphics_context_3d.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h
index 7e14347..1c6c3e3 100644
--- a/cc/thread_proxy.h
+++ b/cc/thread_proxy.h
@@ -87,7 +87,7 @@ private:
base::TimeTicks monotonicFrameBeginTime;
scoped_ptr<ScrollAndScaleSet> scrollInfo;
WebKit::WebTransformationMatrix implTransform;
- PrioritizedTextureManager::BackingList evictedContentsTexturesBackings;
+ PrioritizedResourceManager::BackingList evictedContentsTexturesBackings;
size_t memoryAllocationLimitBytes;
};
scoped_ptr<BeginFrameAndCommitState> m_pendingBeginFrameRequest;
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index 4d4a355..72d23a7 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -39,7 +39,7 @@ public:
}
LayerUpdater::Resource* updaterResource() { return m_updaterResource.get(); }
- PrioritizedTexture* managedTexture() { return m_updaterResource->texture(); }
+ PrioritizedResource* managedResource() { return m_updaterResource->texture(); }
bool isDirty() const { return !dirtyRect.IsEmpty(); }
@@ -205,7 +205,7 @@ void TiledLayer::pushPropertiesTo(LayerImpl* layer)
if (!tile)
continue;
- if (!tile->managedTexture()->haveBackingTexture()) {
+ if (!tile->managedResource()->haveBackingTexture()) {
// Evicted tiles get deleted from both layers
invalidTiles.push_back(tile);
continue;
@@ -217,13 +217,13 @@ void TiledLayer::pushPropertiesTo(LayerImpl* layer)
continue;
}
- tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(), tile->opaqueRect(), tile->managedTexture()->contentsSwizzled());
+ tiledLayer->pushTileProperties(i, j, tile->managedResource()->resourceId(), tile->opaqueRect(), tile->managedResource()->contentsSwizzled());
}
for (std::vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter)
m_tiler->takeTile((*iter)->i(), (*iter)->j());
}
-PrioritizedTextureManager* TiledLayer::textureManager() const
+PrioritizedResourceManager* TiledLayer::resourceManager() const
{
if (!layerTreeHost())
return 0;
@@ -238,7 +238,7 @@ void TiledLayer::setLayerTreeHost(LayerTreeHost* host)
// FIXME: This should not ever be null.
if (!tile)
continue;
- tile->managedTexture()->setTextureManager(host->contentsTextureManager());
+ tile->managedResource()->setTextureManager(host->contentsTextureManager());
}
}
ContentsScalingLayer::setLayerTreeHost(host);
@@ -253,8 +253,8 @@ UpdatableTile* TiledLayer::createTile(int i, int j)
{
createUpdaterIfNeeded();
- scoped_ptr<UpdatableTile> tile(UpdatableTile::create(updater()->createResource(textureManager())));
- tile->managedTexture()->setDimensions(m_tiler->tileSize(), m_textureFormat);
+ scoped_ptr<UpdatableTile> tile(UpdatableTile::create(updater()->createResource(resourceManager())));
+ tile->managedResource()->setDimensions(m_tiler->tileSize(), m_textureFormat);
UpdatableTile* addedTile = tile.get();
m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j);
@@ -311,7 +311,7 @@ void TiledLayer::invalidateContentRect(const gfx::Rect& contentRect)
// Returns true if tile is dirty and only part of it needs to be updated.
bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile)
{
- return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedTexture()->haveBackingTexture();
+ return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedResource()->haveBackingTexture();
}
bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, bool& didPaint)
@@ -361,7 +361,7 @@ void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
tile->occluded = true;
occludedTileCount++;
} else {
- succeeded &= tile->managedTexture()->requestLate();
+ succeeded &= tile->managedResource()->requestLate();
}
}
}
@@ -383,7 +383,7 @@ bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
continue;
// Ensure the entire tile is dirty if we don't have the texture.
- if (!tile->managedTexture()->haveBackingTexture())
+ if (!tile->managedResource()->haveBackingTexture())
tile->dirtyRect = m_tiler->tileRect(tile);
// If using occlusion and the visible region of the tile is occluded,
@@ -391,7 +391,7 @@ bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
if (tile->occluded && !ignoreOcclusions)
continue;
- if (!tile->managedTexture()->canAcquireBackingTexture())
+ if (!tile->managedResource()->canAcquireBackingTexture())
return false;
}
}
@@ -421,7 +421,7 @@ gfx::Rect TiledLayer::markTilesForUpdate(int left, int top, int right, int botto
tile->partialUpdate = true;
else {
tile->dirtyRect = m_tiler->tileRect(tile);
- tile->managedTexture()->returnBackingTexture();
+ tile->managedResource()->returnBackingTexture();
}
}
@@ -536,7 +536,7 @@ void setPriorityForTexture(const gfx::Rect& visibleRect,
const gfx::Rect& tileRect,
bool drawsToRoot,
bool isSmallAnimatedLayer,
- PrioritizedTexture* texture)
+ PrioritizedResource* texture)
{
int priority = PriorityCalculator::lowestPriority();
if (!visibleRect.IsEmpty())
@@ -582,7 +582,7 @@ void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
if (!tile)
continue;
gfx::Rect tileRect = m_tiler->tileRect(tile);
- setPriorityForTexture(m_predictedVisibleRect, tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());
+ setPriorityForTexture(m_predictedVisibleRect, tileRect, drawsToRoot, smallAnimatedLayer, tile->managedResource());
}
}
@@ -759,8 +759,8 @@ bool TiledLayer::needsIdlePaint()
continue;
bool updated = !tile->updateRect.IsEmpty();
- bool canAcquire = tile->managedTexture()->canAcquireBackingTexture();
- bool dirty = tile->isDirty() || !tile->managedTexture()->haveBackingTexture();
+ bool canAcquire = tile->managedResource()->canAcquireBackingTexture();
+ bool dirty = tile->isDirty() || !tile->managedResource()->haveBackingTexture();
if (!updated && canAcquire && dirty)
return true;
}
diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h
index 2fc5fca..052bb99 100644
--- a/cc/tiled_layer.h
+++ b/cc/tiled_layer.h
@@ -64,7 +64,7 @@ protected:
bool skipsDraw() const { return m_skipsDraw; }
// Virtual for testing
- virtual PrioritizedTextureManager* textureManager() const;
+ virtual PrioritizedResourceManager* resourceManager() const;
private:
virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE;
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index e0942f2..8e62bb7 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -51,7 +51,7 @@ public:
TiledLayerTest()
: m_context(WebKit::createFakeGraphicsContext())
, m_queue(make_scoped_ptr(new ResourceUpdateQueue))
- , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool))
+ , m_resourceManager(PrioritizedResourceManager::create(60*1024*1024, 1024, Renderer::ContentPool))
, m_occlusion(0)
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
@@ -60,7 +60,7 @@ public:
virtual ~TiledLayerTest()
{
- textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get());
+ resourceManagerClearAllMemory(m_resourceManager.get(), m_resourceProvider.get());
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
m_resourceProvider.reset();
}
@@ -90,11 +90,11 @@ public:
private:
FakeTiledLayerImpl* m_layerImpl;
};
- void textureManagerClearAllMemory(PrioritizedTextureManager* textureManager, ResourceProvider* resourceProvider)
+ void resourceManagerClearAllMemory(PrioritizedResourceManager* resourceManager, ResourceProvider* resourceProvider)
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- textureManager->clearAllMemory(resourceProvider);
- textureManager->reduceMemory(resourceProvider);
+ resourceManager->clearAllMemory(resourceProvider);
+ resourceManager->reduceMemory(resourceProvider);
}
void updateTextures()
{
@@ -126,12 +126,12 @@ public:
FakeTiledLayerImpl* layerImpl2 = 0)
{
// Get textures
- m_textureManager->clearPriorities();
+ m_resourceManager->clearPriorities();
if (layer1)
layer1->setTexturePriorities(m_priorityCalculator);
if (layer2)
layer2->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// Update content
if (layer1)
@@ -161,13 +161,13 @@ public:
scoped_ptr<ResourceUpdateQueue> m_queue;
RenderingStats m_stats;
PriorityCalculator m_priorityCalculator;
- scoped_ptr<PrioritizedTextureManager> m_textureManager;
+ scoped_ptr<PrioritizedResourceManager> m_resourceManager;
TestOcclusionTracker* m_occlusion;
};
TEST_F(TiledLayerTest, pushDirtyTiles)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -193,7 +193,7 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
TestOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -230,7 +230,7 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
TEST_F(TiledLayerTest, pushDeletedTiles)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -243,9 +243,9 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0));
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
- m_textureManager->clearPriorities();
- textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get());
- m_textureManager->setMaxMemoryLimitBytes(4*1024*1024);
+ m_resourceManager->clearPriorities();
+ resourceManagerClearAllMemory(m_resourceManager.get(), m_resourceProvider.get());
+ m_resourceManager->setMaxMemoryLimitBytes(4*1024*1024);
// This should drop the tiles on the impl thread.
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -265,7 +265,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
TEST_F(TiledLayerTest, pushIdlePaintTiles)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
@@ -301,7 +301,7 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
TEST_F(TiledLayerTest, predictivePainting)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// Prepainting should occur in the scroll direction first, and the
@@ -374,10 +374,10 @@ TEST_F(TiledLayerTest, predictivePainting)
TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
{
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later.
- m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
- scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ m_resourceManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
+ scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl1(1);
- scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl2(2);
// For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
@@ -401,7 +401,7 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
EXPECT_TRUE(needsUpdate);
// Reduce our memory limits to 1mb.
- m_textureManager->setMaxMemoryLimitBytes(1024 * 1024);
+ m_resourceManager->setMaxMemoryLimitBytes(1024 * 1024);
// Now idle paint layer2. We are going to run out of memory though!
// Oh well, commit the frame and push.
@@ -427,7 +427,7 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
TestOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -446,7 +446,7 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -464,8 +464,8 @@ TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
{
- scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
- scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
+ scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layer1Impl(1);
ScopedFakeTiledLayerImpl layer2Impl(2);
@@ -487,8 +487,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
{
- scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
- scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
+ scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layer1Impl(1);
ScopedFakeTiledLayerImpl layer2Impl(2);
@@ -527,9 +527,9 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
if (runOutOfMemory[i])
layerWidth *= 2;
- m_textureManager->setMaxMemoryLimitBytes(memoryForLayer);
+ m_resourceManager->setMaxMemoryLimitBytes(memoryForLayer);
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// Full size layer with half being visible.
@@ -547,7 +547,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
// The layer should paint it's entire contents on the first paint
// if it is close to the viewport size and has the available memory.
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -571,12 +571,12 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
TEST_F(TiledLayerTest, idlePaintOutOfMemory)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel.
- m_textureManager->setMaxMemoryLimitBytes(memoryLimit);
+ m_resourceManager->setMaxMemoryLimitBytes(memoryLimit);
// The tile size is 100x100, so this invalidates and then paints two tiles.
bool needsUpdate = false;
@@ -594,7 +594,7 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
bool animating[2] = {false, true};
@@ -621,7 +621,7 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// Alternate between not visible and visible.
@@ -651,7 +651,7 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
TEST_F(TiledLayerTest, invalidateFromPrepare)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -686,7 +686,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
{
// The updateRect (that indicates what was actually painted) should be in
// layer space, not the content space.
- scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_resourceManager.get()));
gfx::Rect layerBounds(0, 0, 300, 200);
gfx::Rect contentBounds(0, 0, 200, 250);
@@ -700,14 +700,14 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
layer->invalidateContentRect(contentBounds);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->updateRect());
updateTextures();
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->invalidateContentRect(contentBounds);
layer->update(*m_queue.get(), 0, m_stats);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(layerBounds), layer->updateRect());
@@ -717,14 +717,14 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
gfx::Rect partialDamage(30, 100, 10, 10);
layer->invalidateContentRect(partialDamage);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->updateRect());
}
TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
ScopedFakeTiledLayerImpl layerImpl(1);
// Create a layer with one tile.
@@ -737,7 +737,7 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// Push the tiles to the impl side and check that there is exactly one.
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -754,7 +754,7 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// The impl side should get 2x2 tiles now.
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -767,7 +767,7 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// impl side.
layer->setNeedsDisplay();
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 0));
@@ -819,20 +819,20 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
EXPECT_FALSE(rootLayer->skipsDraw());
- textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
+ resourceManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
layerTreeHost->setRootLayer(0);
}
TEST_F(TiledLayerTest, resizeToSmaller)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
layer->setBounds(gfx::Size(700, 700));
layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
layer->invalidateContentRect(gfx::Rect(0, 0, 700, 700));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
layer->setBounds(gfx::Size(200, 200));
@@ -841,7 +841,7 @@ TEST_F(TiledLayerTest, resizeToSmaller)
TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
int size = 1 << 30;
layer->setBounds(gfx::Size(size, size));
@@ -850,7 +850,7 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
// Ensure no crash for bounds where size * size would overflow an int.
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
}
@@ -959,13 +959,13 @@ TEST_F(TiledLayerTest, partialUpdates)
}
layerTreeHost->commitComplete();
- textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
+ resourceManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
layerTreeHost->setRootLayer(0);
}
TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(gfx::Size(100, 200));
@@ -974,14 +974,14 @@ TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
EXPECT_EQ(2, layer->fakeLayerUpdater()->updateCount());
}
TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100.
@@ -994,7 +994,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(36-3, layer->fakeLayerUpdater()->updateCount());
@@ -1004,7 +1004,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->fakeLayerUpdater()->clearUpdateCount();
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
occluded.setOcclusion(gfx::Rect(250, 200, 300, 100));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
@@ -1017,7 +1017,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->fakeLayerUpdater()->clearUpdateCount();
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
occluded.setOcclusion(gfx::Rect(250, 250, 300, 100));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
@@ -1031,7 +1031,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1045,7 +1045,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(24-3, layer->fakeLayerUpdater()->updateCount());
@@ -1061,7 +1061,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 350));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(24-6, layer->fakeLayerUpdater()->updateCount());
@@ -1077,7 +1077,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 340));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(24-6, layer->fakeLayerUpdater()->updateCount());
@@ -1089,7 +1089,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1101,7 +1101,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 600));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(36-3, layer->fakeLayerUpdater()->updateCount());
{
@@ -1114,7 +1114,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
layer->fakeLayerUpdater()->clearUpdateCount();
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted now.
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1127,7 +1127,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1145,7 +1145,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(36-3, layer->fakeLayerUpdater()->updateCount());
@@ -1156,7 +1156,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1177,7 +1177,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
// The content is half the size of the layer (so the number of tiles is fewer).
// In this case, the content is 300x300, and since the tile size is 100, the
@@ -1198,7 +1198,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(9-1, layer->fakeLayerUpdater()->updateCount());
@@ -1221,7 +1221,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(9-1, layer->fakeLayerUpdater()->updateCount());
@@ -1232,7 +1232,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
@@ -1249,7 +1249,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->setDrawOpacity(1);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
@@ -1324,7 +1324,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
TEST_F(TiledLayerTest, pixelsPaintedMetrics)
{
- scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
TestOcclusionTracker occluded;
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
@@ -1341,7 +1341,7 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
layer->setDrawOpacity(1);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// Invalidates and paints the whole layer.
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
@@ -1522,7 +1522,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
}
layerTreeHost->commitComplete();
- textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
+ resourceManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
layerTreeHost->setRootLayer(0);
}
@@ -1546,7 +1546,7 @@ private:
class UpdateTrackingTiledLayer : public FakeTiledLayer {
public:
- explicit UpdateTrackingTiledLayer(PrioritizedTextureManager* manager)
+ explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager)
: FakeTiledLayer(manager)
{
scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::create());
@@ -1568,7 +1568,7 @@ private:
TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
{
- scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
+ scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_resourceManager.get()));
gfx::Rect layerRect(0, 0, 30, 31);
layer->setPosition(layerRect.origin());
@@ -1581,7 +1581,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
layer->setDrawableContentRect(contentRect);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// Update the whole tile.
layer->update(*m_queue.get(), 0, m_stats);
@@ -1599,7 +1599,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
{
- scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
+ scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_resourceManager.get()));
gfx::Rect layerRect(0, 0, 30, 31);
layer->setPosition(layerRect.origin());
@@ -1611,7 +1611,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
layer->setDrawableContentRect(contentRect);
layer->setTexturePriorities(m_priorityCalculator);
- m_textureManager->prioritizeTextures();
+ m_resourceManager->prioritizeTextures();
// Update the whole tile.
layer->update(*m_queue.get(), 0, m_stats);