aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-06-21 12:33:39 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-21 22:19:16 +0000
commit832bd2b69704391d2477a891e873a36b1763c740 (patch)
tree1fd5398f93bf32d6158fa763d7da622043cab268 /src/core
parente0a33e28e2786fb17be2edf28e04cd62bfe4ec1e (diff)
Add a concat method to SkTInternalLList
Bug: skia: Change-Id: I3d62aff691f6cc08b7995bd72dbfd6289c803c6a Reviewed-on: https://skia-review.googlesource.com/20380 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkTInternalLList.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/core/SkTInternalLList.h b/src/core/SkTInternalLList.h
index 1aa1a12209..00a8743976 100644
--- a/src/core/SkTInternalLList.h
+++ b/src/core/SkTInternalLList.h
@@ -167,8 +167,34 @@ public:
#endif
}
+ void concat(SkTInternalLList&& list) {
+ if (list.isEmpty()) {
+ return;
+ }
+
+ list.fHead->fPrev = fTail;
+ if (!fHead) {
+ SkASSERT(!list.fHead->fPrev);
+ fHead = list.fHead;
+ } else {
+ SkASSERT(fTail);
+ fTail->fNext = list.fHead;
+ }
+ fTail = list.fTail;
+
+#ifdef SK_DEBUG
+ for (T* node = list.fHead; node; node = node->fNext) {
+ SkASSERT(node->fList == &list);
+ node->fList = this;
+ }
+#endif
+
+ list.fHead = list.fTail = nullptr;
+ }
+
bool isEmpty() const {
- return NULL == fHead && NULL == fTail;
+ SkASSERT(SkToBool(fHead) == SkToBool(fTail));
+ return !fHead;
}
T* head() { return fHead; }