From 9be085c313537c895fcaf1b8ec2ab33593743fee Mon Sep 17 00:00:00 2001 From: bungeman Date: Mon, 26 Jan 2015 17:41:02 -0800 Subject: [PATCH] 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} --- content/common/font_config_ipc_linux.cc | 7 ++++--- content/common/font_config_ipc_linux.h | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/content/common/font_config_ipc_linux.cc b/content/common/font_config_ipc_linux.cc index c64aebf66a57..8de951b6f53d 100644 --- a/content/common/font_config_ipc_linux.cc +++ b/content/common/font_config_ipc_linux.cc @@ -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 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; } diff --git a/content/common/font_config_ipc_linux.h b/content/common/font_config_ipc_linux.h index c5cf80f72744..170828679869 100644 --- a/content/common/font_config_ipc_linux.h +++ b/content/common/font_config_ipc_linux.h @@ -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 +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, -- 2.11.4.GIT