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

Unified Diff: third_party/WebKit/Source/wtf/HashMapTest.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/HashFunctions.h ('k') | third_party/WebKit/Source/wtf/HashSetTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/HashMapTest.cpp
diff --git a/third_party/WebKit/Source/wtf/HashMapTest.cpp b/third_party/WebKit/Source/wtf/HashMapTest.cpp
index f8b97ed0214f7085949dcfd1d696008d01b9a8f7..17583d95cb930f9dd7d82dd6d818fafdb6d9110f 100644
--- a/third_party/WebKit/Source/wtf/HashMapTest.cpp
+++ b/third_party/WebKit/Source/wtf/HashMapTest.cpp
@@ -26,9 +26,8 @@
#include "wtf/HashMap.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/PtrUtil.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include <memory>
@@ -104,14 +103,14 @@ private:
int* m_destructNumber;
};
-using OwnPtrHashMap = HashMap<int, OwnPtr<DestructCounter>>;
+using OwnPtrHashMap = HashMap<int, std::unique_ptr<DestructCounter>>;
TEST(HashMapTest, OwnPtrAsValue)
{
int destructNumber = 0;
OwnPtrHashMap map;
- map.add(1, adoptPtr(new DestructCounter(1, &destructNumber)));
- map.add(2, adoptPtr(new DestructCounter(2, &destructNumber)));
+ map.add(1, wrapUnique(new DestructCounter(1, &destructNumber)));
+ map.add(2, wrapUnique(new DestructCounter(2, &destructNumber)));
DestructCounter* counter1 = map.get(1);
EXPECT_EQ(1, counter1->get());
@@ -120,12 +119,12 @@ TEST(HashMapTest, OwnPtrAsValue)
EXPECT_EQ(0, destructNumber);
for (OwnPtrHashMap::iterator iter = map.begin(); iter != map.end(); ++iter) {
- OwnPtr<DestructCounter>& ownCounter = iter->value;
+ std::unique_ptr<DestructCounter>& ownCounter = iter->value;
EXPECT_EQ(iter->key, ownCounter->get());
}
ASSERT_EQ(0, destructNumber);
- OwnPtr<DestructCounter> ownCounter1 = map.take(1);
+ std::unique_ptr<DestructCounter> ownCounter1 = map.take(1);
EXPECT_EQ(ownCounter1.get(), counter1);
EXPECT_FALSE(map.contains(1));
EXPECT_EQ(0, destructNumber);
@@ -243,7 +242,7 @@ public:
private:
int m_v;
};
-using IntSimpleMap = HashMap<int, OwnPtr<SimpleClass>>;
+using IntSimpleMap = HashMap<int, std::unique_ptr<SimpleClass>>;
TEST(HashMapTest, AddResult)
{
@@ -254,10 +253,10 @@ TEST(HashMapTest, AddResult)
EXPECT_EQ(0, result.storedValue->value.get());
SimpleClass* simple1 = new SimpleClass(1);
- result.storedValue->value = adoptPtr(simple1);
+ result.storedValue->value = wrapUnique(simple1);
EXPECT_EQ(simple1, map.get(1));
- IntSimpleMap::AddResult result2 = map.add(1, adoptPtr(new SimpleClass(2)));
+ IntSimpleMap::AddResult result2 = map.add(1, wrapUnique(new SimpleClass(2)));
EXPECT_FALSE(result2.isNewEntry);
EXPECT_EQ(1, result.storedValue->key);
EXPECT_EQ(1, result.storedValue->value->v());
« no previous file with comments | « third_party/WebKit/Source/wtf/HashFunctions.h ('k') | third_party/WebKit/Source/wtf/HashSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698