aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRemoteGlyphCache.h
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-04-05 16:57:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-06 18:18:34 +0000
commit4961a938586e3c46cf80f15ecb70a011324bfe59 (patch)
tree3bd002a6ecbbe934207e54aa170f0b71a2f3aca8 /src/core/SkRemoteGlyphCache.h
parentc5a1c1f92f67c3f2b54250d040d3d3cd51e2feb7 (diff)
Remove all notion of transport from the API.
There is only a need to pass buffers in and out of the system. All transport is external to the system. Change-Id: I26dfc8e0b4cce9969395c96d5230078e7dca3f3d Reviewed-on: https://skia-review.googlesource.com/119062 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Khushal Sagar <khushalsagar@google.com>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.h')
-rw-r--r--src/core/SkRemoteGlyphCache.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/core/SkRemoteGlyphCache.h b/src/core/SkRemoteGlyphCache.h
index 3dfa8c28e5..04d72a083b 100644
--- a/src/core/SkRemoteGlyphCache.h
+++ b/src/core/SkRemoteGlyphCache.h
@@ -19,26 +19,15 @@
#include "SkGlyphCache.h"
#include "SkMakeUnique.h"
#include "SkNoDrawCanvas.h"
+#include "SkRefCnt.h"
#include "SkSerialProcs.h"
#include "SkTextBlobRunIterator.h"
#include "SkTHash.h"
#include "SkTypeface.h"
#include "SkTypeface_remote.h"
-class SkScalerContextRecDescriptor;
-
-class SkRemoteStrikeTransport {
-public:
- enum IOResult : bool {kFail = false, kSuccess = true};
-
- virtual ~SkRemoteStrikeTransport() {}
- virtual IOResult write(const void*, size_t) = 0;
- virtual std::tuple<size_t, IOResult> read(void*, size_t) = 0;
- IOResult writeSkData(const SkData&);
- sk_sp<SkData> readSkData();
- IOResult writeVector(const std::vector<uint8_t>&);
- IOResult readVector(std::vector<uint8_t>*);
-};
+// The client uses a SkStrikeCacheClientRPC to send and receive data.
+using SkStrikeCacheClientRPC = std::function<sk_sp<SkData>(const SkData&)>;
class SkScalerContextRecDescriptor {
public:
@@ -94,7 +83,7 @@ private:
} fDescriptor;
};
-class SkStrikeCacheDifferenceSpec {
+class SK_API SkStrikeCacheDifferenceSpec {
class StrikeDifferences;
public:
@@ -131,7 +120,7 @@ private:
DescMap fDescriptorToDifferencesMap{16, DescHash(), DescEq()};
};
-class SkTextBlobCacheDiffCanvas : public SkNoDrawCanvas {
+class SK_API SkTextBlobCacheDiffCanvas : public SkNoDrawCanvas {
public:
SkTextBlobCacheDiffCanvas(int width, int height,
const SkMatrix& deviceMatrix,
@@ -164,13 +153,14 @@ private:
SkStrikeCacheDifferenceSpec* const fStrikeCacheDiff;
};
-class SkStrikeServer {
+class SK_API SkStrikeServer {
public:
- SkStrikeServer(SkRemoteStrikeTransport* transport);
+ SkStrikeServer();
~SkStrikeServer();
// embedding clients call these methods
- int serve(); // very negotiable
+ void serve(const SkData&, std::vector<uint8_t>*);
+
void prepareSerializeProcs(SkSerialProcs* procs);
// mostly called internally by Skia
@@ -185,14 +175,13 @@ private:
sk_sp<SkData> encodeTypeface(SkTypeface* tf);
int fOpCount = 0;
- SkRemoteStrikeTransport* const fTransport;
SkTHashMap<SkFontID, sk_sp<SkTypeface>> fTypefaceMap;
DescriptorToContextMap fScalerContextMap;
};
-class SkStrikeClient {
+class SK_API SkStrikeClient {
public:
- SkStrikeClient(SkRemoteStrikeTransport*);
+ SkStrikeClient(SkStrikeCacheClientRPC);
// embedding clients call these methods
void primeStrikeCache(const SkStrikeCacheDifferenceSpec&);
@@ -213,7 +202,7 @@ private:
// TODO: Figure out how to manage the entries for the following maps.
SkTHashMap<SkFontID, sk_sp<SkTypefaceProxy>> fMapIdToTypeface;
- SkRemoteStrikeTransport* const fTransport;
+ SkStrikeCacheClientRPC fClientRPC;
std::vector<uint8_t> fBuffer;
};