Factor out `validate` into separate method.
Factor out `validate` into separate method.

Change-Id: I7362e16182d42c971a2cb5bdcbdc242ef900d6b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312493
Reviewed-by: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>
Commit-Queue: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>
Auto-Submit: John Stiles <f4fcf42d3bb5924557f1eeb3be66747535e585da@google.com>

aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia