Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:16.0:FactoryCandidates
nodejs-electron
harfbuzz-replace-HbScopedPointer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File harfbuzz-replace-HbScopedPointer.patch of Package nodejs-electron
From 5fcaeafcab5460ea65e4a7bdee6589002adf74d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20R=C3=B6ttsches?= <drott@chromium.org> Date: Mon, 13 Feb 2023 13:26:16 +0000 Subject: [PATCH] Use hb::unique_ptr instead of custom HbScopedPointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was an earlier local RAII implementation that we no longer need now that HarfBuzz provides helpers for this. Change-Id: Idc47ce2717c75556acb03e2ccccb50ec87ed3cca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4239980 Reviewed-by: Munira Tursunova <moonira@google.com> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/main@{#1104453} --- .../platform/fonts/shaping/harfbuzz_shaper.cc | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc index c165a1703395a..dc1377a90a9f7 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc @@ -35,6 +35,7 @@ #include <unicode/uchar.h> #include <unicode/uscript.h> #include <algorithm> +#include <hb-cplusplus.hh> #include <memory> #include <utility> @@ -194,33 +195,6 @@ struct ReshapeQueueItem { : action_(action), start_index_(start), num_characters_(num) {} }; -template <typename T> -class HarfBuzzScopedPtr { - STACK_ALLOCATED(); - - public: - typedef void (*DestroyFunction)(T*); - - HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy) - : ptr_(ptr), destroy_(destroy) { - DCHECK(destroy_); - } - HarfBuzzScopedPtr(const HarfBuzzScopedPtr&) = delete; - HarfBuzzScopedPtr& operator=(const HarfBuzzScopedPtr&) = delete; - ~HarfBuzzScopedPtr() { - if (ptr_) - (*destroy_)(ptr_); - } - - T* Get() const{ return ptr_; } - operator T *() const {return ptr_;} - void Set(T* ptr) { ptr_ = ptr; } - - private: - T* ptr_; - DestroyFunction destroy_; -}; - // // Represents a context while shaping a range. // @@ -239,7 +214,7 @@ struct RangeContext { text_direction(direction), start(start), end(end), - buffer(hb_buffer_create(), hb_buffer_destroy), + buffer(hb_buffer_create()), options(options) { DCHECK_GE(end, start); font_features.Initialize(font->GetFontDescription()); @@ -249,7 +224,7 @@ struct RangeContext { const TextDirection text_direction; const unsigned start; const unsigned end; - const HarfBuzzScopedPtr<hb_buffer_t> buffer; + const hb::unique_ptr<hb_buffer_t> buffer; FontFeatures font_features; Deque<ReshapeQueueItem> reshape_queue; const ShapeOptions options; @@ -1032,7 +1007,7 @@ void HarfBuzzShaper::GetGlyphData(const UScriptCode script, bool is_horizontal, GlyphDataList& glyphs) { - HarfBuzzScopedPtr<hb_buffer_t> hb_buffer(hb_buffer_create(), hb_buffer_destroy); + hb::unique_ptr<hb_buffer_t> hb_buffer(hb_buffer_create()); hb_buffer_set_language(hb_buffer, locale.HarfbuzzLanguage()); hb_buffer_set_script(hb_buffer, ICUScriptToHBScript(script)); hb_buffer_set_direction(hb_buffer,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor