Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef InterpolationInvalidators_h | |
| 6 #define InterpolationInvalidators_h | |
| 7 | |
| 8 #include "platform/heap/Handle.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 class StyleResolverState; | |
| 13 | |
| 14 class InterpolationInvalidators : public RefCountedWillBeGarbageCollectedFinaliz ed<InterpolationInvalidators> { | |
|
shans
2015/05/28 05:48:13
This needs either documentation, better names, or
alancutter (OOO until 2018)
2015/06/01 07:35:29
ConversionInvalidator is probably more accurate si
| |
| 15 public: | |
| 16 virtual ~InterpolationInvalidators() { } | |
| 17 | |
| 18 bool chainIsInvalid(const StyleResolverState& state) | |
| 19 { | |
| 20 return isInvalid(state) || (m_next && m_next->chainIsInvalid(state)); | |
| 21 } | |
| 22 | |
| 23 static void chain(RefPtrWillBeRawPtr<InterpolationInvalidators>& prefix, Pas sRefPtrWillBeRawPtr<InterpolationInvalidators> suffix) | |
|
Eric Willigers
2015/05/28 00:34:48
It would be nice to have a unit test that uses cha
alancutter (OOO until 2018)
2015/06/01 07:35:29
Done.
| |
| 24 { | |
| 25 if (!suffix) | |
| 26 return; | |
| 27 if (!prefix) | |
| 28 prefix = suffix; | |
| 29 else if (prefix != suffix) | |
| 30 prefix->chainWith(suffix); | |
| 31 } | |
| 32 | |
| 33 DEFINE_INLINE_VIRTUAL_TRACE() | |
| 34 { | |
| 35 visitor->trace(m_next); | |
| 36 } | |
| 37 | |
| 38 protected: | |
| 39 virtual bool isInvalid(const StyleResolverState&) = 0; | |
| 40 | |
| 41 private: | |
| 42 void chainWith(PassRefPtrWillBeRawPtr<InterpolationInvalidators> suffix) | |
|
shans
2015/05/28 05:48:13
Maybe use a Vector instead? This seems rather heav
alancutter (OOO until 2018)
2015/06/01 07:35:29
This is actually designed to be lightweight in the
| |
| 43 { | |
| 44 ASSERT(suffix); | |
| 45 InterpolationInvalidators* current = this; | |
| 46 while (current->m_next) { | |
| 47 if (current == suffix) | |
| 48 return; | |
| 49 current = current->m_next.get(); | |
| 50 } | |
| 51 current->m_next = suffix; | |
| 52 } | |
| 53 | |
| 54 RefPtrWillBeMember<InterpolationInvalidators> m_next; | |
| 55 }; | |
| 56 | |
| 57 } // namespace blink | |
| 58 | |
| 59 #endif // InterpolationInvalidators_h | |
| OLD | NEW |