aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/Viewer.h
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-11-22 12:07:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-22 17:34:44 +0000
commitb2ba6644cfc311a12f30c99449ff1b76e0a22b69 (patch)
tree8cae834ad6f22cce4a35976814c3da0f9609a842 /tools/viewer/Viewer.h
parent90dcafcc93899e268a7f00ae2fbaa6515fa7eb29 (diff)
Add threaded backend to viewer
Bug: skia: Change-Id: Ibf672921f8a05705e7262aad0b1f3f1e6fc0ef9c Reviewed-on: https://skia-review.googlesource.com/75382 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'tools/viewer/Viewer.h')
-rw-r--r--tools/viewer/Viewer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/viewer/Viewer.h b/tools/viewer/Viewer.h
index 24f68b4964..53b75b2de3 100644
--- a/tools/viewer/Viewer.h
+++ b/tools/viewer/Viewer.h
@@ -13,6 +13,7 @@
#include "sk_app/Window.h"
#include "gm.h"
#include "SkAnimTimer.h"
+#include "SkExecutor.h"
#include "SkJSONCPP.h"
#include "SkTouchGesture.h"
#include "Slide.h"
@@ -59,6 +60,10 @@ private:
void changeZoomLevel(float delta);
SkMatrix computeMatrix();
+ void resetExecutor() {
+ fExecutor = SkExecutor::MakeFIFOThreadPool(fThreadCnt == 0 ? fTileCnt : fThreadCnt);
+ }
+
sk_app::Window* fWindow;
static const int kMeasurementCount = 1 << 6; // should be power of 2 for fast mod
@@ -112,6 +117,10 @@ private:
SkTArray<std::function<void(void)>> fDeferredActions;
Json::Value fAllSlideNames; // cache all slide names for fast updateUIState
+
+ int fTileCnt;
+ int fThreadCnt;
+ std::unique_ptr<SkExecutor> fExecutor;
};