summaryrefslogtreecommitdiff
path: root/chromium/components/services/font
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-31 15:50:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:35:23 +0000
commit7b2ffa587235a47d4094787d72f38102089f402a (patch)
tree30e82af9cbab08a7fa028bb18f4f2987a3f74dfa /chromium/components/services/font
parentd94af01c90575348c4e81a418257f254b6f8d225 (diff)
downloadqtwebengine-chromium-7b2ffa587235a47d4094787d72f38102089f402a.tar.gz
BASELINE: Update Chromium to 76.0.3809.94
Change-Id: I321c3f5f929c105aec0f98c5091ef6108822e647 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/services/font')
-rw-r--r--chromium/components/services/font/font_loader_unittest.cc2
-rw-r--r--chromium/components/services/font/main.cc4
-rw-r--r--chromium/components/services/font/ppapi_fontconfig_matching.cc33
3 files changed, 20 insertions, 19 deletions
diff --git a/chromium/components/services/font/font_loader_unittest.cc b/chromium/components/services/font/font_loader_unittest.cc
index c7984dbb6f5..5e7118a8a6a 100644
--- a/chromium/components/services/font/font_loader_unittest.cc
+++ b/chromium/components/services/font/font_loader_unittest.cc
@@ -40,7 +40,7 @@ std::string GetPostscriptNameFromFile(base::File& font_file) {
return "";
std::vector<char> file_contents;
- file_contents.reserve(file_size);
+ file_contents.resize(file_size);
CHECK_EQ(file_size, font_file.Read(0, file_contents.data(), file_size));
std::string font_family_name;
FT_Library library;
diff --git a/chromium/components/services/font/main.cc b/chromium/components/services/font/main.cc
index a9b13867949..b5e2a098c58 100644
--- a/chromium/components/services/font/main.cc
+++ b/chromium/components/services/font/main.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/message_loop/message_loop.h"
+#include "base/task/single_thread_task_executor.h"
#include "components/services/font/font_service_app.h"
#include "services/service_manager/public/cpp/service_executable/service_main.h"
void ServiceMain(service_manager::mojom::ServiceRequest request) {
- base::MessageLoop message_loop;
+ base::SingleThreadTaskExecutor main_thread_task_executor;
font_service::FontServiceApp(std::move(request)).RunUntilTermination();
}
diff --git a/chromium/components/services/font/ppapi_fontconfig_matching.cc b/chromium/components/services/font/ppapi_fontconfig_matching.cc
index 731779843bd..e95ecbe6784 100644
--- a/chromium/components/services/font/ppapi_fontconfig_matching.cc
+++ b/chromium/components/services/font/ppapi_fontconfig_matching.cc
@@ -11,6 +11,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <memory>
#include <string>
#include "base/posix/eintr_wrapper.h"
@@ -127,10 +128,12 @@ int MatchFontFaceWithFallback(const std::string& face,
bool is_italic,
uint32_t charset,
uint32_t fallback_family) {
- FcLangSet* langset = FcLangSetCreate();
- bool is_lgc = MSCharSetToFontconfig(langset, charset);
- FcPattern* pattern = FcPatternCreate();
- FcPatternAddString(pattern, FC_FAMILY,
+ std::unique_ptr<FcLangSet, decltype(&FcLangSetDestroy)> langset(
+ FcLangSetCreate(), &FcLangSetDestroy);
+ bool is_lgc = MSCharSetToFontconfig(langset.get(), charset);
+ std::unique_ptr<FcPattern, decltype(&FcPatternDestroy)> pattern(
+ FcPatternCreate(), &FcPatternDestroy);
+ FcPatternAddString(pattern.get(), FC_FAMILY,
reinterpret_cast<const FcChar8*>(face.c_str()));
// TODO(thestig) Check if we can access Chrome's per-script font preference
@@ -152,20 +155,22 @@ int MatchFontFaceWithFallback(const std::string& face,
if (!generic_font_name.empty()) {
const FcChar8* fc_generic_font_name =
reinterpret_cast<const FcChar8*>(generic_font_name.c_str());
- FcPatternAddString(pattern, FC_FAMILY, fc_generic_font_name);
+ FcPatternAddString(pattern.get(), FC_FAMILY, fc_generic_font_name);
}
if (is_bold)
- FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
+ FcPatternAddInteger(pattern.get(), FC_WEIGHT, FC_WEIGHT_BOLD);
if (is_italic)
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
- FcPatternAddLangSet(pattern, FC_LANG, langset);
- FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
- FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
+ FcPatternAddInteger(pattern.get(), FC_SLANT, FC_SLANT_ITALIC);
+ FcPatternAddLangSet(pattern.get(), FC_LANG, langset.get());
+ FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue);
+ FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern);
+ FcDefaultSubstitute(pattern.get());
FcResult result;
- FcFontSet* font_set = FcFontSort(nullptr, pattern, 0, nullptr, &result);
+ std::unique_ptr<FcFontSet, decltype(&FcFontSetDestroy)> font_set(
+ FcFontSort(nullptr, pattern.get(), 0, nullptr, &result),
+ &FcFontSetDestroy);
int font_fd = -1;
int good_enough_index = -1;
bool good_enough_index_set = false;
@@ -259,10 +264,6 @@ int MatchFontFaceWithFallback(const std::string& face,
}
}
- if (font_set)
- FcFontSetDestroy(font_set);
- FcPatternDestroy(pattern);
-
return font_fd;
}