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

Side by Side Diff: third_party/WebKit/Source/core/css/invalidation/InvalidationSetTest.cpp

Issue 1389333003: Do not keep InvalidationSets on the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/invalidation/InvalidationSet.h" 6 #include "core/css/invalidation/InvalidationSet.h"
7 7
8 #include <gtest/gtest.h> 8 #include <gtest/gtest.h>
9 9
10 namespace blink { 10 namespace blink {
11 11
12 // Once we setWholeSubtreeInvalid, we should not keep the HashSets. 12 // Once we setWholeSubtreeInvalid, we should not keep the HashSets.
13 TEST(InvalidationSetTest, SubtreeInvalid_AddBefore) 13 TEST(InvalidationSetTest, SubtreeInvalid_AddBefore)
14 { 14 {
15 RefPtrWillBeRawPtr<InvalidationSet> set = InvalidationSet::create(); 15 RefPtr<InvalidationSet> set = InvalidationSet::create();
16 set->addClass("a"); 16 set->addClass("a");
17 set->setWholeSubtreeInvalid(); 17 set->setWholeSubtreeInvalid();
18 18
19 ASSERT_TRUE(set->isEmpty()); 19 ASSERT_TRUE(set->isEmpty());
20 } 20 }
21 21
22 // Don't (re)create HashSets if we've already setWholeSubtreeInvalid. 22 // Don't (re)create HashSets if we've already setWholeSubtreeInvalid.
23 TEST(InvalidationSetTest, SubtreeInvalid_AddAfter) 23 TEST(InvalidationSetTest, SubtreeInvalid_AddAfter)
24 { 24 {
25 RefPtrWillBeRawPtr<InvalidationSet> set = InvalidationSet::create(); 25 RefPtr<InvalidationSet> set = InvalidationSet::create();
26 set->setWholeSubtreeInvalid(); 26 set->setWholeSubtreeInvalid();
27 set->addTagName("a"); 27 set->addTagName("a");
28 28
29 ASSERT_TRUE(set->isEmpty()); 29 ASSERT_TRUE(set->isEmpty());
30 } 30 }
31 31
32 // No need to keep the HashSets when combining with a wholeSubtreeInvalid set. 32 // No need to keep the HashSets when combining with a wholeSubtreeInvalid set.
33 TEST(InvalidationSetTest, SubtreeInvalid_Combine_1) 33 TEST(InvalidationSetTest, SubtreeInvalid_Combine_1)
34 { 34 {
35 RefPtrWillBeRawPtr<InvalidationSet> set1 = InvalidationSet::create(); 35 RefPtr<InvalidationSet> set1 = InvalidationSet::create();
36 RefPtrWillBeRawPtr<InvalidationSet> set2 = InvalidationSet::create(); 36 RefPtr<InvalidationSet> set2 = InvalidationSet::create();
37 37
38 set1->addId("a"); 38 set1->addId("a");
39 set2->setWholeSubtreeInvalid(); 39 set2->setWholeSubtreeInvalid();
40 40
41 set1->combine(*set2); 41 set1->combine(*set2);
42 42
43 ASSERT_TRUE(set1->wholeSubtreeInvalid()); 43 ASSERT_TRUE(set1->wholeSubtreeInvalid());
44 ASSERT_TRUE(set1->isEmpty()); 44 ASSERT_TRUE(set1->isEmpty());
45 } 45 }
46 46
47 // No need to add HashSets from combining set when we already have wholeSubtreeI nvalid. 47 // No need to add HashSets from combining set when we already have wholeSubtreeI nvalid.
48 TEST(InvalidationSetTest, SubtreeInvalid_Combine_2) 48 TEST(InvalidationSetTest, SubtreeInvalid_Combine_2)
49 { 49 {
50 RefPtrWillBeRawPtr<InvalidationSet> set1 = InvalidationSet::create(); 50 RefPtr<InvalidationSet> set1 = InvalidationSet::create();
51 RefPtrWillBeRawPtr<InvalidationSet> set2 = InvalidationSet::create(); 51 RefPtr<InvalidationSet> set2 = InvalidationSet::create();
52 52
53 set1->setWholeSubtreeInvalid(); 53 set1->setWholeSubtreeInvalid();
54 set2->addAttribute("a"); 54 set2->addAttribute("a");
55 55
56 set1->combine(*set2); 56 set1->combine(*set2);
57 57
58 ASSERT_TRUE(set1->wholeSubtreeInvalid()); 58 ASSERT_TRUE(set1->wholeSubtreeInvalid());
59 ASSERT_TRUE(set1->isEmpty()); 59 ASSERT_TRUE(set1->isEmpty());
60 } 60 }
61 61
62 TEST(InvalidationSetTest, SubtreeInvalid_AddCustomPseudoBefore) 62 TEST(InvalidationSetTest, SubtreeInvalid_AddCustomPseudoBefore)
63 { 63 {
64 RefPtrWillBeRawPtr<InvalidationSet> set = InvalidationSet::create(); 64 RefPtr<InvalidationSet> set = InvalidationSet::create();
65 set->setCustomPseudoInvalid(); 65 set->setCustomPseudoInvalid();
66 ASSERT_FALSE(set->isEmpty()); 66 ASSERT_FALSE(set->isEmpty());
67 67
68 set->setWholeSubtreeInvalid(); 68 set->setWholeSubtreeInvalid();
69 ASSERT_TRUE(set->isEmpty()); 69 ASSERT_TRUE(set->isEmpty());
70 } 70 }
71 71
72 #ifndef NDEBUG 72 #ifndef NDEBUG
73 TEST(InvalidationSetTest, ShowDebug) 73 TEST(InvalidationSetTest, ShowDebug)
74 { 74 {
75 RefPtrWillBeRawPtr<InvalidationSet> set = InvalidationSet::create(); 75 RefPtr<InvalidationSet> set = InvalidationSet::create();
76 set->show(); 76 set->show();
77 } 77 }
78 #endif // NDEBUG 78 #endif // NDEBUG
79 79
80 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698