OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/dom/StyleEngine.h" | 5 #include "core/dom/StyleEngine.h" |
6 | 6 |
7 #include "core/css/StyleSheetContents.h" | 7 #include "core/css/StyleSheetContents.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/NodeComputedStyle.h" | 9 #include "core/dom/NodeComputedStyle.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // Check that the second sheet uses the cached StyleSheetContents for the fi
rst. | 87 // Check that the second sheet uses the cached StyleSheetContents for the fi
rst. |
88 EXPECT_EQ(sheet1->contents(), sheet2->contents()); | 88 EXPECT_EQ(sheet1->contents(), sheet2->contents()); |
89 EXPECT_TRUE(sheet2->contents()->isUsedFromTextCache()); | 89 EXPECT_TRUE(sheet2->contents()->isUsedFromTextCache()); |
90 | 90 |
91 sheet1 = nullptr; | 91 sheet1 = nullptr; |
92 sheet2 = nullptr; | 92 sheet2 = nullptr; |
93 element = nullptr; | 93 element = nullptr; |
94 | 94 |
95 // Garbage collection should clear the weak reference in the StyleSheetConte
nts cache. | 95 // Garbage collection should clear the weak reference in the StyleSheetConte
nts cache. |
96 ThreadState::current()-> collectAllGarbage(); | 96 ThreadHeap::collectAllGarbage(); |
97 | 97 |
98 element = HTMLStyleElement::create(document(), false); | 98 element = HTMLStyleElement::create(document(), false); |
99 sheet1 = styleEngine().createSheet(element, sheetText, minPos, context); | 99 sheet1 = styleEngine().createSheet(element, sheetText, minPos, context); |
100 | 100 |
101 // Check that we did not use a cached StyleSheetContents after the garbage c
ollection. | 101 // Check that we did not use a cached StyleSheetContents after the garbage c
ollection. |
102 EXPECT_FALSE(sheet1->contents()->isUsedFromTextCache()); | 102 EXPECT_FALSE(sheet1->contents()->isUsedFromTextCache()); |
103 } | 103 } |
104 | 104 |
105 } // namespace blink | 105 } // namespace blink |
OLD | NEW |