Chromium Code Reviews| 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. | |
|
haraken
2014/10/15 01:12:56
I'm planning to address the FIXME by introducing G
tkent
2014/10/15 03:34:39
The GarbageCollectedOnMainThread approach sounds g
| |
| 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 derivesNode = WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, Node> ::value | |
|
tkent
2014/10/15 03:34:39
Now derivesNode is a wrong name. It will be remov
haraken
2014/10/15 03:38:59
Renamed it to mainThreadOnly.
| |
| 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 // whether the page is part of a terminting thread or | 920 // whether the page is part of a terminting thread or |
| 916 // if the page is traced after being terminated (orphaned). | 921 // if the page is traced after being terminated (orphaned). |
| 917 uintptr_t m_terminating : 1; | 922 uintptr_t m_terminating : 1; |
| 918 uintptr_t m_tracedAfterOrphaned : 1; | 923 uintptr_t m_tracedAfterOrphaned : 1; |
| 919 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 | 924 uintptr_t m_promptlyFreedSize : 17; // == blinkPageSizeLog2 |
| 920 }; | 925 }; |
| 921 | 926 |
| 922 } | 927 } |
| 923 | 928 |
| 924 #endif // ThreadState_h | 929 #endif // ThreadState_h |
| OLD | NEW |