diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:20:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:28:57 +0000 |
commit | d17ea114e5ef69ad5d5d7413280a13e6428098aa (patch) | |
tree | 2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc | |
parent | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff) | |
download | qtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz |
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc b/chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc new file mode 100644 index 00000000000..e90f6d72a80 --- /dev/null +++ b/chromium/third_party/blink/renderer/platform/fonts/font_global_context.cc @@ -0,0 +1,46 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/fonts/font_global_context.h" + +#include "third_party/blink/renderer/platform/fonts/font_cache.h" +#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" +#include "third_party/blink/renderer/platform/wtf/thread_specific.h" + +namespace blink { + +FontGlobalContext* FontGlobalContext::Get(CreateIfNeeded create_if_needed) { + DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<FontGlobalContext*>, + font_persistent, ()); + if (!*font_persistent && create_if_needed == kCreate) { + *font_persistent = new FontGlobalContext(); + } + return *font_persistent; +} + +FontGlobalContext::FontGlobalContext() + : harfbuzz_font_funcs_(nullptr), + default_locale_(nullptr), + system_locale_(nullptr), + default_locale_for_han_(nullptr), + has_default_locale_for_han_(false) {} + +void FontGlobalContext::ClearMemory() { + if (!Get(kDoNotCreate)) + return; + + GetFontCache().Invalidate(); +} + +void FontGlobalContext::ClearForTesting() { + FontGlobalContext* ctx = Get(); + ctx->default_locale_ = nullptr; + ctx->system_locale_ = nullptr; + ctx->default_locale_for_han_ = nullptr; + ctx->has_default_locale_for_han_ = false; + ctx->layout_locale_map_.clear(); + ctx->font_cache_.Invalidate(); +} + +} // namespace blink |