| OLD | NEW |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // | 77 // |
| 78 // FIXME: We should evaluate the performance gain. Having | 78 // FIXME: We should evaluate the performance gain. Having |
| 79 // ThreadAffinity is complicating the implementation and we should get | 79 // ThreadAffinity is complicating the implementation and we should get |
| 80 // rid of it if it is fast enough to go through thread-local storage | 80 // rid of it if it is fast enough to go through thread-local storage |
| 81 // always. | 81 // always. |
| 82 enum ThreadAffinity { | 82 enum ThreadAffinity { |
| 83 AnyThread, | 83 AnyThread, |
| 84 MainThreadOnly, | 84 MainThreadOnly, |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // FIXME: These forward declarations violate dependency rules. Remove them. |
| 88 // Ideally we want to provide a USED_IN_MAIN_THREAD_ONLY(T) macro, which |
| 89 // indicates that classes in T's hierarchy are used only by the main thread. |
| 87 class Node; | 90 class Node; |
| 88 class CSSValue; | 91 class NodeList; |
| 89 | 92 |
| 90 template<typename T, bool derivesNode = WTF::IsSubclass<typename WTF::RemoveCons
t<T>::Type, Node>::value> struct DefaultThreadingTrait; | 93 template<typename T, |
| 94 bool mainThreadOnly = WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, No
de>::value |
| 95 || WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, NodeList>::value>
struct DefaultThreadingTrait; |
| 91 | 96 |
| 92 template<typename T> | 97 template<typename T> |
| 93 struct DefaultThreadingTrait<T, false> { | 98 struct DefaultThreadingTrait<T, false> { |
| 94 static const ThreadAffinity Affinity = AnyThread; | 99 static const ThreadAffinity Affinity = AnyThread; |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 template<typename T> | 102 template<typename T> |
| 98 struct DefaultThreadingTrait<T, true> { | 103 struct DefaultThreadingTrait<T, true> { |
| 99 static const ThreadAffinity Affinity = MainThreadOnly; | 104 static const ThreadAffinity Affinity = MainThreadOnly; |
| 100 }; | 105 }; |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 // whether the page is part of a terminting thread or | 942 // whether the page is part of a terminting thread or |
| 938 // if the page is traced after being terminated (orphaned). | 943 // if the page is traced after being terminated (orphaned). |
| 939 uintptr_t m_terminating : 1; | 944 uintptr_t m_terminating : 1; |
| 940 uintptr_t m_tracedAfterOrphaned : 1; | 945 uintptr_t m_tracedAfterOrphaned : 1; |
| 941 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 | 946 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 |
| 942 }; | 947 }; |
| 943 | 948 |
| 944 } | 949 } |
| 945 | 950 |
| 946 #endif // ThreadState_h | 951 #endif // ThreadState_h |
| OLD | NEW |