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

Unified Diff: src/core/SkPicture.cpp

Issue 751663002: Remove Picture deletion listeners. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: f Created 6 years, 1 month 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/core/SkPicture.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index b24f7196d0d25f13b55149c94fb6bf764f70e353..b4c3063991e008364ece984d7644c2936da31d8e 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -17,6 +17,7 @@
#include "SkCanvas.h"
#include "SkChunkAlloc.h"
#include "SkDrawPictureCallback.h"
+#include "SkMessageBus.h"
#include "SkPaintPriv.h"
#include "SkPathEffect.h"
#include "SkPicture.h"
@@ -41,6 +42,8 @@
#include "SkRecordOpts.h"
#include "SkRecorder.h"
+DECLARE_SKMESSAGEBUS_MESSAGE(SkPicture::DeletionMessage);
+
template <typename T> int SafeCount(const T* obj) {
return obj ? obj->count() : 0;
}
@@ -278,7 +281,9 @@ SkPicture const* const* SkPicture::drawablePicts() const {
}
SkPicture::~SkPicture() {
- this->callDeletionListeners();
+ SkPicture::DeletionMessage msg;
+ msg.fUniqueID = this->uniqueID();
+ SkMessageBus<SkPicture::DeletionMessage>::Post(msg);
}
void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) const {
@@ -526,21 +531,3 @@ SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
, fDrawablePicts(drawablePicts)
, fAnalysis(*fRecord)
{}
-
-// Note that we are assuming that this entry point will only be called from
-// one thread. Currently the only client of this method is
-// SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single
-// thread.
-void SkPicture::addDeletionListener(DeletionListener* listener) const {
- SkASSERT(listener);
-
- *fDeletionListeners.append() = SkRef(listener);
-}
-
-void SkPicture::callDeletionListeners() {
- for (int i = 0; i < fDeletionListeners.count(); ++i) {
- fDeletionListeners[i]->onDeletion(this->uniqueID());
- }
-
- fDeletionListeners.unrefAll();
-}
« no previous file with comments | « include/core/SkPicture.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698