diff options
author | Herb Derby <herb@google.com> | 2018-04-08 03:56:42 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-08 04:29:01 +0000 |
commit | 4473907dee6b34785ac5dafba7561c40977d9786 (patch) | |
tree | f472129434ad5678837f02bf9280360f1a6cd6f9 /src/core/SkRemoteGlyphCache.h | |
parent | 87fa2b08aa949b85d0ceef1c1535a57a4c5cdeb4 (diff) |
Revert "Remove all notion of transport from the API."
This reverts commit 4961a938586e3c46cf80f15ecb70a011324bfe59.
Reason for revert: Breaks MSVC
Original change's description:
> 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>
TBR=herb@google.com,reed@google.com,khushalsagar@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I62cbac1be4483702ba7464822d93fb9f818f88b7
Reviewed-on: https://skia-review.googlesource.com/119580
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.h')
-rw-r--r-- | src/core/SkRemoteGlyphCache.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/core/SkRemoteGlyphCache.h b/src/core/SkRemoteGlyphCache.h index 04d72a083b..3dfa8c28e5 100644 --- a/src/core/SkRemoteGlyphCache.h +++ b/src/core/SkRemoteGlyphCache.h @@ -19,15 +19,26 @@ #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" -// The client uses a SkStrikeCacheClientRPC to send and receive data. -using SkStrikeCacheClientRPC = std::function<sk_sp<SkData>(const SkData&)>; +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>*); +}; class SkScalerContextRecDescriptor { public: @@ -83,7 +94,7 @@ private: } fDescriptor; }; -class SK_API SkStrikeCacheDifferenceSpec { +class SkStrikeCacheDifferenceSpec { class StrikeDifferences; public: @@ -120,7 +131,7 @@ private: DescMap fDescriptorToDifferencesMap{16, DescHash(), DescEq()}; }; -class SK_API SkTextBlobCacheDiffCanvas : public SkNoDrawCanvas { +class SkTextBlobCacheDiffCanvas : public SkNoDrawCanvas { public: SkTextBlobCacheDiffCanvas(int width, int height, const SkMatrix& deviceMatrix, @@ -153,14 +164,13 @@ private: SkStrikeCacheDifferenceSpec* const fStrikeCacheDiff; }; -class SK_API SkStrikeServer { +class SkStrikeServer { public: - SkStrikeServer(); + SkStrikeServer(SkRemoteStrikeTransport* transport); ~SkStrikeServer(); // embedding clients call these methods - void serve(const SkData&, std::vector<uint8_t>*); - + int serve(); // very negotiable void prepareSerializeProcs(SkSerialProcs* procs); // mostly called internally by Skia @@ -175,13 +185,14 @@ private: sk_sp<SkData> encodeTypeface(SkTypeface* tf); int fOpCount = 0; + SkRemoteStrikeTransport* const fTransport; SkTHashMap<SkFontID, sk_sp<SkTypeface>> fTypefaceMap; DescriptorToContextMap fScalerContextMap; }; -class SK_API SkStrikeClient { +class SkStrikeClient { public: - SkStrikeClient(SkStrikeCacheClientRPC); + SkStrikeClient(SkRemoteStrikeTransport*); // embedding clients call these methods void primeStrikeCache(const SkStrikeCacheDifferenceSpec&); @@ -202,7 +213,7 @@ private: // TODO: Figure out how to manage the entries for the following maps. SkTHashMap<SkFontID, sk_sp<SkTypefaceProxy>> fMapIdToTypeface; - SkStrikeCacheClientRPC fClientRPC; + SkRemoteStrikeTransport* const fTransport; std::vector<uint8_t> fBuffer; }; |