take fast case in swap() if we're using malloc OR we're empty
authorMike Reed <reed@google.com>
Thu, 9 Mar 2017 21:36:26 +0000 (16:36 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 9 Mar 2017 22:26:12 +0000 (22:26 +0000)
commit6c14c8db4b1378dd1df66401f0a7cc9fc83fe732
treeff2af260ee5f898fb04d3c36793ae086c5ef5213
parentf1b61afbe97199896bfbcadb68758bfcf0dc803a
take fast case in swap() if we're using malloc OR we're empty

This avoids taking the (more expensive) copy case when we don't need to.
The old behavior only took this fast case if we were "actively" using
a dynamically allocated array.

BUG=skia:

Change-Id: I0f606ba83ff4aff3a8fc282db7a3ce1b0191fb1a
Reviewed-on: https://skia-review.googlesource.com/9521
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
include/private/SkTArray.h