diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/components/services/font | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) | |
download | qtwebengine-chromium-c551f43206405019121bd2b2c93714319a0a3300.tar.gz |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/services/font')
-rw-r--r-- | chromium/components/services/font/font_service_app.cc | 23 | ||||
-rw-r--r-- | chromium/components/services/font/font_service_app.h | 6 |
2 files changed, 15 insertions, 14 deletions
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<uint32_t>(index); @@ -137,9 +140,8 @@ void FontServiceApp::OpenStream(uint32_t id_number, DCHECK_LT(id_number, static_cast<uint32_t>(paths_.size())); base::File file; - if (id_number < static_cast<uint32_t>(paths_.size())) { - file = GetFileForPath(base::FilePath(paths_[id_number].c_str())); - } + if (id_number < static_cast<uint32_t>(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<uint32_t>(index); @@ -206,8 +208,7 @@ void FontServiceApp::MatchFontByPostscriptNameOrFullFontName( base::Optional<FontConfigLocalMatching::FontConfigMatchResult> 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 <stdint.h> #include <vector> +#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<mojom::FontService> receivers_; // We don't want to leak paths to our callers; we thus enumerate the paths of // fonts. - std::vector<SkString> paths_; + std::vector<base::FilePath> paths_; DISALLOW_COPY_AND_ASSIGN(FontServiceApp); }; |