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

Unified Diff: include/gpu/GrTextureProvider.h

Issue 1567983002: Add guards to GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@gpudeviceguards
Patch Set: got it Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTextureProvider.h
diff --git a/include/gpu/GrTextureProvider.h b/include/gpu/GrTextureProvider.h
index 5635583d80fef393a746ae75f32edc0d2a3c8025..46f381da81f1fd5b5c0cdd82ba13829d95f58c52 100644
--- a/include/gpu/GrTextureProvider.h
+++ b/include/gpu/GrTextureProvider.h
@@ -11,6 +11,8 @@
#include "GrTexture.h"
#include "SkImageFilter.h"
+class GrSingleOwner;
+
class SK_API GrTextureProvider {
public:
///////////////////////////////////////////////////////////////////////////
@@ -42,15 +44,7 @@ public:
}
/** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
- GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key) {
- GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key);
- if (resource) {
- GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture();
- SkASSERT(texture);
- return texture;
- }
- return NULL;
- }
+ GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key);
/**
* Determines whether a texture is associated with the unique key. If the texture is found it
@@ -134,7 +128,7 @@ public:
GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
protected:
- GrTextureProvider(GrGpu* gpu, GrResourceCache* cache) : fCache(cache), fGpu(gpu) {}
+ GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner);
/**
* Assigns a unique key to a resource. If the key is associated with another resource that
@@ -186,6 +180,9 @@ protected:
private:
GrResourceCache* fCache;
GrGpu* fGpu;
+
+ // In debug builds we guard against improper thread handling
+ SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
};
#endif
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698