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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 SetIteratorCheck(it5, weakOrderedSet->end(), 64); 3464 SetIteratorCheck(it5, weakOrderedSet->end(), 64);
3465 } 3465 }
3466 } else { 3466 } else {
3467 // Collect garbage. This causes weak processing to remove 3467 // Collect garbage. This causes weak processing to remove
3468 // things from the collections. 3468 // things from the collections.
3469 preciselyCollectGarbage(); 3469 preciselyCollectGarbage();
3470 unsigned count = 0; 3470 unsigned count = 0;
3471 for (int i = 0; i < 128; i += 2) { 3471 for (int i = 0; i < 128; i += 2) {
3472 bool firstAlive = keepNumbersAlive[i]; 3472 bool firstAlive = keepNumbersAlive[i];
3473 bool secondAlive = keepNumbersAlive[i + 1]; 3473 bool secondAlive = keepNumbersAlive[i + 1];
3474 if (firstAlive && (collectionNumber == weakStrongIndex || 3474 if (firstAlive &&
3475 collectionNumber == strongWeakIndex)) 3475 (collectionNumber == weakStrongIndex ||
3476 collectionNumber == strongWeakIndex))
3476 secondAlive = true; 3477 secondAlive = true;
3477 if (firstAlive && secondAlive && 3478 if (firstAlive && secondAlive &&
3478 collectionNumber < numberOfMapIndices) { 3479 collectionNumber < numberOfMapIndices) {
3479 if (collectionNumber == weakStrongIndex) { 3480 if (collectionNumber == weakStrongIndex) {
3480 if (deleteAfterwards) 3481 if (deleteAfterwards)
3481 EXPECT_EQ(i + 1, 3482 EXPECT_EQ(i + 1,
3482 weakStrong->take(keepNumbersAlive[i])->value()); 3483 weakStrong->take(keepNumbersAlive[i])->value());
3483 } else if (collectionNumber == strongWeakIndex) { 3484 } else if (collectionNumber == strongWeakIndex) {
3484 if (deleteAfterwards) 3485 if (deleteAfterwards)
3485 EXPECT_EQ(i, 3486 EXPECT_EQ(i,
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
5010 keepAlive->push_back(value); 5011 keepAlive->push_back(value);
5011 OuterMap::AddResult newEntry = outer->insert(value, InnerMap()); 5012 OuterMap::AddResult newEntry = outer->insert(value, InnerMap());
5012 newEntry.storedValue->value.insert(deep, home); 5013 newEntry.storedValue->value.insert(deep, home);
5013 newEntry.storedValue->value.insert(composite, home); 5014 newEntry.storedValue->value.insert(composite, home);
5014 } 5015 }
5015 composite.clear(); 5016 composite.clear();
5016 preciselyCollectGarbage(); 5017 preciselyCollectGarbage();
5017 EXPECT_EQ(10000u, outer->size()); 5018 EXPECT_EQ(10000u, outer->size());
5018 for (int i = 0; i < 10000; i++) { 5019 for (int i = 0; i < 10000; i++) {
5019 IntWrapper* value = keepAlive->at(i); 5020 IntWrapper* value = keepAlive->at(i);
5020 EXPECT_EQ(1u, outer->get(value) 5021 EXPECT_EQ(1u,
5021 .size()); // Other one was deleted by weak handling. 5022 outer->get(value)
5023 .size()); // Other one was deleted by weak handling.
5022 if (i & 1) 5024 if (i & 1)
5023 keepAlive->at(i) = nullptr; 5025 keepAlive->at(i) = nullptr;
5024 } 5026 }
5025 preciselyCollectGarbage(); 5027 preciselyCollectGarbage();
5026 EXPECT_EQ(5000u, outer->size()); 5028 EXPECT_EQ(5000u, outer->size());
5027 } 5029 }
5028 } 5030 }
5029 } 5031 }
5030 5032
5031 class EphemeronWrapper : public GarbageCollected<EphemeronWrapper> { 5033 class EphemeronWrapper : public GarbageCollected<EphemeronWrapper> {
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
6357 "HeapVector"); 6359 "HeapVector");
6358 static_assert( 6360 static_assert(
6359 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, 6361 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value,
6360 "HeapDeque"); 6362 "HeapDeque");
6361 static_assert(WTF::IsGarbageCollectedType< 6363 static_assert(WTF::IsGarbageCollectedType<
6362 HeapTerminatedArray<Member<IntWrapper>>>::value, 6364 HeapTerminatedArray<Member<IntWrapper>>>::value,
6363 "HeapTerminatedArray"); 6365 "HeapTerminatedArray");
6364 } 6366 }
6365 6367
6366 } // namespace blink 6368 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698