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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/FontCache.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
index 3a7a8db2b36ae38f15abb6e66edf6d4b82c66917..ac4a0eb34f26bdd72d2a26ddb78e44ab0a39f96d 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -50,12 +50,10 @@
#include "public/platform/Platform.h"
#include "wtf/HashMap.h"
#include "wtf/ListHashSet.h"
-#include "wtf/PtrUtil.h"
#include "wtf/StdLibExtras.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicStringHash.h"
#include "wtf/text/StringHash.h"
-#include <memory>
using namespace WTF;
@@ -69,9 +67,9 @@ FontCache::FontCache()
}
#endif // !OS(WIN) && !OS(LINUX)
-typedef HashMap<unsigned, std::unique_ptr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet;
+typedef HashMap<unsigned, OwnPtr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet;
typedef HashMap<FontCacheKey, SizedFontPlatformDataSet, FontCacheKeyHash, FontCacheKeyTraits> FontPlatformDataCache;
-typedef HashMap<FallbackListCompositeKey, std::unique_ptr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache;
+typedef HashMap<FallbackListCompositeKey, OwnPtr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache;
static FontPlatformDataCache* gFontPlatformDataCache = nullptr;
static FallbackListShaperCache* gFallbackListShaperCache = nullptr;
@@ -120,7 +118,7 @@ FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
// Take a different size instance of the same font before adding an entry to |sizedFont|.
FontPlatformData* anotherSize = wasEmpty ? nullptr : sizedFonts->begin()->value.get();
auto addResult = sizedFonts->add(roundedSize, nullptr);
- std::unique_ptr<FontPlatformData>* found = &addResult.storedValue->value;
+ OwnPtr<FontPlatformData>* found = &addResult.storedValue->value;
if (addResult.isNewEntry) {
if (wasEmpty)
*found = createFontPlatformData(fontDescription, creationParams, size);
@@ -143,19 +141,19 @@ FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
if (result) {
// Cache the result under the old name.
auto adding = &gFontPlatformDataCache->add(key, SizedFontPlatformDataSet()).storedValue->value;
- adding->set(roundedSize, wrapUnique(new FontPlatformData(*result)));
+ adding->set(roundedSize, adoptPtr(new FontPlatformData(*result)));
}
}
return result;
}
-std::unique_ptr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize)
+PassOwnPtr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize)
{
#if OS(MACOSX)
return createFontPlatformData(fontDescription, creationParams, fontSize);
#else
- return wrapUnique(new FontPlatformData(fontPlatformData, fontSize));
+ return adoptPtr(new FontPlatformData(fontPlatformData, fontSize));
#endif
}
@@ -168,7 +166,7 @@ ShapeCache* FontCache::getShapeCache(const FallbackListCompositeKey& key)
ShapeCache* result = nullptr;
if (it == gFallbackListShaperCache->end()) {
result = new ShapeCache();
- gFallbackListShaperCache->set(key, wrapUnique(result));
+ gFallbackListShaperCache->set(key, adoptPtr(result));
} else {
result = it->value.get();
}

Powered by Google App Engine
This is Rietveld 408576698