Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #include "platform/fonts/shaping/HarfBuzzFace.h" 31 #include "platform/fonts/shaping/HarfBuzzFace.h"
32 32
33 #include "platform/fonts/FontCache.h" 33 #include "platform/fonts/FontCache.h"
34 #include "platform/fonts/FontPlatformData.h" 34 #include "platform/fonts/FontPlatformData.h"
35 #include "platform/fonts/SimpleFontData.h" 35 #include "platform/fonts/SimpleFontData.h"
36 #include "platform/fonts/UnicodeRangeSet.h" 36 #include "platform/fonts/UnicodeRangeSet.h"
37 #include "platform/fonts/shaping/HarfBuzzShaper.h" 37 #include "platform/fonts/shaping/HarfBuzzShaper.h"
38 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
39 #include "wtf/MathExtras.h" 39 #include "wtf/MathExtras.h"
40 #include "wtf/PtrUtil.h"
41 #include <memory>
40 42
41 #include <hb-ot.h> 43 #include <hb-ot.h>
42 #include <hb.h> 44 #include <hb.h>
43 #if OS(MACOSX) 45 #if OS(MACOSX)
44 #include <hb-coretext.h> 46 #include <hb-coretext.h>
45 #endif 47 #endif
46 48
47 #include <SkPaint.h> 49 #include <SkPaint.h>
48 #include <SkPath.h> 50 #include <SkPath.h>
49 #include <SkPoint.h> 51 #include <SkPoint.h>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ASSERT(hbFont); 107 ASSERT(hbFont);
106 return adoptRef(new HbFontCacheEntry(hbFont)); 108 return adoptRef(new HbFontCacheEntry(hbFont));
107 } 109 }
108 110
109 hb_font_t* hbFont() { return m_hbFont.get(); } 111 hb_font_t* hbFont() { return m_hbFont.get(); }
110 HarfBuzzFontData* hbFontData() { return m_hbFontData.get(); } 112 HarfBuzzFontData* hbFontData() { return m_hbFontData.get(); }
111 113
112 private: 114 private:
113 explicit HbFontCacheEntry(hb_font_t* font) 115 explicit HbFontCacheEntry(hb_font_t* font)
114 : m_hbFont(HbFontUniquePtr(font)) 116 : m_hbFont(HbFontUniquePtr(font))
115 , m_hbFontData(adoptPtr(new HarfBuzzFontData())) 117 , m_hbFontData(wrapUnique(new HarfBuzzFontData()))
116 { }; 118 { };
117 119
118 HbFontUniquePtr m_hbFont; 120 HbFontUniquePtr m_hbFont;
119 OwnPtr<HarfBuzzFontData> m_hbFontData; 121 std::unique_ptr<HarfBuzzFontData> m_hbFontData;
120 }; 122 };
121 123
122 typedef HashMap<uint64_t, RefPtr<HbFontCacheEntry>, WTF::IntHash<uint64_t>, WTF: :UnsignedWithZeroKeyHashTraits<uint64_t>> HarfBuzzFontCache; 124 typedef HashMap<uint64_t, RefPtr<HbFontCacheEntry>, WTF::IntHash<uint64_t>, WTF: :UnsignedWithZeroKeyHashTraits<uint64_t>> HarfBuzzFontCache;
123 125
124 static HarfBuzzFontCache* harfBuzzFontCache() 126 static HarfBuzzFontCache* harfBuzzFontCache()
125 { 127 {
126 DEFINE_STATIC_LOCAL(HarfBuzzFontCache, s_harfBuzzFontCache, ()); 128 DEFINE_STATIC_LOCAL(HarfBuzzFontCache, s_harfBuzzFontCache, ());
127 return &s_harfBuzzFontCache; 129 return &s_harfBuzzFontCache;
128 } 130 }
129 131
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 m_platformData->setupPaint(&m_harfBuzzFontData->m_paint); 339 m_platformData->setupPaint(&m_harfBuzzFontData->m_paint);
338 m_harfBuzzFontData->m_rangeSet = rangeSet; 340 m_harfBuzzFontData->m_rangeSet = rangeSet;
339 m_harfBuzzFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromF ontPlatformData(m_platformData).get(); 341 m_harfBuzzFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromF ontPlatformData(m_platformData).get();
340 ASSERT(m_harfBuzzFontData->m_simpleFontData); 342 ASSERT(m_harfBuzzFontData->m_simpleFontData);
341 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); 343 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size());
342 hb_font_set_scale(m_unscaledFont, scale, scale); 344 hb_font_set_scale(m_unscaledFont, scale, scale);
343 return m_unscaledFont; 345 return m_unscaledFont;
344 } 346 }
345 347
346 } // namespace blink 348 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698