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

Unified Diff: cc/resources/resource_provider.h

Issue 43753002: cc: Keep track of busy resources in ResourcePool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/resource_provider.h
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 23f1414fa0d6d921c23ca2b4555e00f0296f12fb..5f6dd34f94ea484062fd6f523e69b30e10b4e3f7 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -15,6 +15,7 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "cc/base/cc_export.h"
#include "cc/output/context_provider.h"
@@ -42,10 +43,12 @@ namespace cc {
class SharedBitmap;
class SharedBitmapManager;
class TextureUploader;
+class ResourceProviderClient;
// This class is not thread-safe and can only be called from the thread it was
// created on (in practice, the impl thread).
-class CC_EXPORT ResourceProvider {
+class CC_EXPORT ResourceProvider
+ : public base::SupportsWeakPtr<ResourceProvider> {
piman 2013/10/25 21:51:11 we want to remove the use of SupportsWeakPtr in th
public:
typedef unsigned ResourceId;
typedef std::vector<ResourceId> ResourceIdArray;
@@ -68,6 +71,8 @@ class CC_EXPORT ResourceProvider {
bool use_rgba_4444_texture_format);
virtual ~ResourceProvider();
+ void SetClient(ResourceProviderClient* client);
+
void InitializeSoftware();
bool InitializeGL();
@@ -84,6 +89,7 @@ class CC_EXPORT ResourceProvider {
bool InUseByConsumer(ResourceId id);
bool IsLost(ResourceId id);
+ bool IsExported(ResourceId id);
// Producer interface.
@@ -469,6 +475,7 @@ class CC_EXPORT ResourceProvider {
// Returns NULL if the output_surface_ does not have a ContextProvider.
WebKit::WebGraphicsContext3D* Context3d() const;
+ ResourceProviderClient* client_;
OutputSurface* output_surface_;
SharedBitmapManager* shared_bitmap_manager_;
bool lost_output_surface_;
@@ -495,6 +502,11 @@ class CC_EXPORT ResourceProvider {
DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
};
+class ResourceProviderClient {
+ public:
+ virtual void ResourceExported(ResourceProvider::ResourceId id) = 0;
+ virtual void ResourceReturned(ResourceProvider::ResourceId id) = 0;
+};
// TODO(epenner): Move these format conversions to resource_format.h
// once that builds on mac (npapi.h currently #includes OpenGL.h).

Powered by Google App Engine
This is Rietveld 408576698