Commit 9be085c3 authored by bungeman's avatar bungeman Committed by Commit bot

Move to SkStreamAsset for SkTypeface streams.

SkTypeface is moving to use SkStreamAsset instead of SkStream. The
implementations are already assuming this, and all users are in
practice already creating the correct types. This change simply
clarifies existing practice and documents actual restrictions.

The Skia side change will be https://codereview.chromium.org/869763002/

Review URL: https://codereview.chromium.org/870133002

Cr-Commit-Position: refs/heads/master@{#313196}
parent 9ca5b72d
......@@ -20,11 +20,12 @@
#include "skia/ext/skia_utils_base.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
namespace content {
// Return a stream from the file descriptor, or NULL on failure.
SkStream* StreamFromFD(int fd) {
SkStreamAsset* StreamFromFD(int fd) {
skia::RefPtr<SkData> data = skia::AdoptRef(SkData::NewFromFD(fd));
if (!data) {
return NULL;
......@@ -94,7 +95,7 @@ bool FontConfigIPC::matchFamilyName(const char familyName[],
return true;
}
SkStream* FontConfigIPC::openStream(const FontIdentity& identity) {
SkStreamAsset* FontConfigIPC::openStream(const FontIdentity& identity) {
TRACE_EVENT0("sandbox_ipc", "FontConfigIPC::openStream");
Pickle request;
request.WriteInt(METHOD_OPEN);
......@@ -118,7 +119,7 @@ SkStream* FontConfigIPC::openStream(const FontIdentity& identity) {
return NULL;
}
SkStream* stream = StreamFromFD(result_fd);
SkStreamAsset* stream = StreamFromFD(result_fd);
CloseFD(result_fd);
return stream;
}
......
......@@ -6,10 +6,14 @@
#define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h"
#include <string>
class SkString;
namespace content {
// FontConfig implementation for Skia that proxies out of process to get out
......@@ -25,7 +29,7 @@ class FontConfigIPC : public SkFontConfigInterface {
SkString* outFamilyName,
SkTypeface::Style* outStyle) override;
SkStream* openStream(const FontIdentity&) override;
SkStreamAsset* openStream(const FontIdentity&) override;
enum Method {
METHOD_MATCH = 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment