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

Unified Diff: cc/resources/resource_provider.h

Issue 170783007: Re-land: cc: Cleanup internal::WorkerPoolTaskClient interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View 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 dd7e200e3e1e73b13541ebb2130f7a3396690dcf..f07e5f618cd4f9bcb1d3671d5263d6d9380ea375 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -331,14 +331,15 @@ class CC_EXPORT ResourceProvider {
SkCanvas* MapImageRasterBuffer(ResourceId id);
void UnmapImageRasterBuffer(ResourceId id);
- // Returns a canvas backed by pixel buffer.
+ // Returns a canvas backed by pixel buffer. UnmapPixelRasterBuffer
+ // returns true if canvas was written to while mapped.
// The pixel buffer needs to be uploaded to the underlying resource
// using BeginSetPixels before the resouce can be used for compositing.
// It is used by PixelRasterWorkerPool.
void AcquirePixelRasterBuffer(ResourceId id);
void ReleasePixelRasterBuffer(ResourceId id);
SkCanvas* MapPixelRasterBuffer(ResourceId id);
- void UnmapPixelRasterBuffer(ResourceId id);
+ bool UnmapPixelRasterBuffer(ResourceId id);
// Asynchronously update pixels from acquired pixel buffer.
void BeginSetPixels(ResourceId id);
@@ -450,7 +451,7 @@ class CC_EXPORT ResourceProvider {
virtual ~RasterBuffer();
SkCanvas* LockForWrite();
- void UnlockForWrite();
+ bool UnlockForWrite();
protected:
RasterBuffer(const Resource* resource, ResourceProvider* resource_provider);
@@ -458,7 +459,7 @@ class CC_EXPORT ResourceProvider {
ResourceProvider* resource_provider() const { return resource_provider_; }
virtual SkCanvas* DoLockForWrite() = 0;
- virtual void DoUnlockForWrite() = 0;
+ virtual bool DoUnlockForWrite() = 0;
private:
const Resource* resource_;
@@ -475,11 +476,13 @@ class CC_EXPORT ResourceProvider {
protected:
virtual SkCanvas* DoLockForWrite() OVERRIDE;
- virtual void DoUnlockForWrite() OVERRIDE;
+ virtual bool DoUnlockForWrite() OVERRIDE;
skia::RefPtr<SkSurface> CreateSurface();
private:
skia::RefPtr<SkSurface> surface_;
+ uint32_t surface_generation_id_;
+
DISALLOW_COPY_AND_ASSIGN(DirectRasterBuffer);
};
@@ -492,7 +495,7 @@ class CC_EXPORT ResourceProvider {
ResourceProvider* resource_provider);
virtual SkCanvas* DoLockForWrite() OVERRIDE;
- virtual void DoUnlockForWrite() OVERRIDE;
+ virtual bool DoUnlockForWrite() OVERRIDE;
virtual uint8_t* MapBuffer(int* stride) = 0;
virtual void UnmapBuffer() = 0;
@@ -500,6 +503,7 @@ class CC_EXPORT ResourceProvider {
private:
uint8_t* mapped_buffer_;
SkBitmap raster_bitmap_;
+ uint32_t raster_bitmap_generation_id_;
skia::RefPtr<SkCanvas> raster_canvas_;
};

Powered by Google App Engine
This is Rietveld 408576698