virtual void onPostInflate(const SkTDict<SkView*>&);
public:
+#ifdef SK_DEBUG
+ void validate() const;
+#else
+ void validate() const {}
+#endif
// default action is to inval the view
virtual void onFocusChange(bool gainFocusP);
+
protected:
// override these if you're acting as a layer/host
virtual bool onGetFocusView(SkView**) const { return false; }
virtual bool onSetFocusView(SkView*) { return false; }
-#ifdef SK_DEBUG
- void validate() const;
-#else
- void validate() const {}
-#endif
private:
SkScalar fWidth, fHeight;
SkMatrix fMatrix;
}
virtual bool onEvent(const SkEvent& evt) {
if (evt.isType(gReplaceTransitionEvt)) {
+ SkView* prev = fPrev;
+ prev->ref();
+
fPrev->detachFromParent();
fPrev = (SkView*)SkEventSink::FindSink(evt.getFast32());
(void)SampleView::SetUsePipe(fPrev, SkOSMenu::kOffState);
//attach the new fPrev and call unref to balance the ref in onDraw
this->attachChildToBack(fPrev)->unref();
this->inval(NULL);
+
+ SkASSERT(1 == prev->getRefCnt());
+ prev->unref();
return true;
}
if (evt.isType("transition-done")) {
this->detachFromParent_NoLayout();
parent->invokeLayout();
}
- this->validate();
}
SkView* SkView::attachChildToBack(SkView* child) {
#ifdef SK_DEBUG
void SkView::validate() const {
+// SkASSERT(this->getRefCnt() > 0 && this->getRefCnt() < 100);
if (fParent) {
SkASSERT(fNextSibling);
SkASSERT(fPrevSibling);