From c551f43206405019121bd2b2c93714319a0a3300 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 23 Jan 2020 17:21:03 +0100 Subject: BASELINE: Update Chromium to 79.0.3945.139 Change-Id: I336b7182fab9bca80b709682489c07db112eaca5 Reviewed-by: Allan Sandfeld Jensen --- .../components/services/font/font_service_app.cc | 23 +++++++++++----------- .../components/services/font/font_service_app.h | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'chromium/components/services/font') diff --git a/chromium/components/services/font/font_service_app.cc b/chromium/components/services/font/font_service_app.cc index 16c1958793e..210c2b8b387 100644 --- a/chromium/components/services/font/font_service_app.cc +++ b/chromium/components/services/font/font_service_app.cc @@ -10,10 +10,12 @@ #include "base/command_line.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "components/services/font/fontconfig_matching.h" #include "mojo/public/cpp/system/platform_handle.h" #include "ppapi/buildflags/buildflags.h" +#include "skia/ext/skia_utils_base.h" #include "ui/gfx/font_fallback_linux.h" #include "ui/gfx/font_render_params.h" @@ -115,7 +117,8 @@ void FontServiceApp::MatchFamilyName(const std::string& family_name, // Stash away the returned path, so we can give it an ID (index) // which will later be given to us in a request to open the file. - int index = FindOrAddPath(result_identity.fString); + base::FilePath path(result_identity.fString.c_str()); + size_t index = FindOrAddPath(path); mojom::FontIdentityPtr identity(mojom::FontIdentity::New()); identity->id = static_cast(index); @@ -137,9 +140,8 @@ void FontServiceApp::OpenStream(uint32_t id_number, DCHECK_LT(id_number, static_cast(paths_.size())); base::File file; - if (id_number < static_cast(paths_.size())) { - file = GetFileForPath(base::FilePath(paths_[id_number].c_str())); - } + if (id_number < static_cast(paths_.size())) + file = GetFileForPath(paths_[id_number]); std::move(callback).Run(std::move(file)); } @@ -151,7 +153,7 @@ void FontServiceApp::FallbackFontForCharacter( TRACE_EVENT0("fonts", "FontServiceApp::FallbackFontForCharacter"); auto fallback_font = gfx::GetFallbackFontForChar(character, locale); - int index = FindOrAddPath(SkString(fallback_font.filename.data())); + size_t index = FindOrAddPath(base::FilePath(fallback_font.filename)); mojom::FontIdentityPtr identity(mojom::FontIdentity::New()); identity->id = static_cast(index); @@ -206,8 +208,7 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( base::Optional match_result = FontConfigLocalMatching::FindFontByPostscriptNameOrFullFontName(family); if (match_result) { - uint32_t fontconfig_interface_id = - FindOrAddPath(SkString(match_result->file_path.value().c_str())); + uint32_t fontconfig_interface_id = FindOrAddPath(match_result->file_path); mojom::FontIdentityPtr font_identity = mojom::FontIdentityPtr(mojom::FontIdentity::New( fontconfig_interface_id, match_result->ttc_index, @@ -240,11 +241,11 @@ void FontServiceApp::MatchFontWithFallback( #endif } -int FontServiceApp::FindOrAddPath(const SkString& path) { +size_t FontServiceApp::FindOrAddPath(const base::FilePath& path) { TRACE_EVENT1("fonts", "FontServiceApp::FindOrAddPath", "path", - TRACE_STR_COPY(path.c_str())); - int count = paths_.size(); - for (int i = 0; i < count; ++i) { + path.AsUTF8Unsafe()); + size_t count = paths_.size(); + for (size_t i = 0; i < count; ++i) { if (path == paths_[i]) return i; } diff --git a/chromium/components/services/font/font_service_app.h b/chromium/components/services/font/font_service_app.h index eb920d55798..e46d79f5c6f 100644 --- a/chromium/components/services/font/font_service_app.h +++ b/chromium/components/services/font/font_service_app.h @@ -8,10 +8,10 @@ #include #include +#include "base/files/file_path.h" #include "base/macros.h" #include "components/services/font/public/mojom/font_service.mojom.h" #include "mojo/public/cpp/bindings/receiver_set.h" -#include "skia/ext/skia_utils_base.h" namespace font_service { @@ -48,13 +48,13 @@ class FontServiceApp : public mojom::FontService { uint32_t charset, uint32_t fallbackFamilyType, MatchFontWithFallbackCallback callback) override; - int FindOrAddPath(const SkString& path); + size_t FindOrAddPath(const base::FilePath& path); mojo::ReceiverSet receivers_; // We don't want to leak paths to our callers; we thus enumerate the paths of // fonts. - std::vector paths_; + std::vector paths_; DISALLOW_COPY_AND_ASSIGN(FontServiceApp); }; -- cgit v1.2.1