OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // | 62 // |
63 // const char* MyClass::supplementName() | 63 // const char* MyClass::supplementName() |
64 // { | 64 // { |
65 // return "MyClass"; | 65 // return "MyClass"; |
66 // } | 66 // } |
67 // | 67 // |
68 // An example of the using the key: | 68 // An example of the using the key: |
69 // | 69 // |
70 // MyClass* MyClass::from(MySupplementable* host) | 70 // MyClass* MyClass::from(MySupplementable* host) |
71 // { | 71 // { |
72 // return static_cast<MyClass*>(Supplement<MySupplementable>::from(host,
supplementName())); | 72 // return static_cast<MyClass*>( |
| 73 // Supplement<MySupplementable>::from(host, supplementName())); |
73 // } | 74 // } |
74 // | 75 // |
75 // What you should know about thread checks | 76 // What you should know about thread checks |
76 // ======================================== | 77 // ======================================== |
77 // When assertion is enabled this class performs thread-safety check so that | 78 // When assertion is enabled this class performs thread-safety check so that |
78 // provideTo and from happen on the same thread. If you want to provide | 79 // provideTo and from happen on the same thread. If you want to provide |
79 // some value for Workers this thread check may not work very well though, | 80 // some value for Workers this thread check may not work very well though, |
80 // since in most case you'd provide the value while worker preparation is | 81 // since in most case you'd provide the value while worker preparation is |
81 // being done on the main thread, even before the worker thread is started. | 82 // being done on the main thread, even before the worker thread is started. |
82 // If that's the case you can explicitly call reattachThread() when the | 83 // If that's the case you can explicitly call reattachThread() when the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 }; | 165 }; |
165 | 166 |
166 template <typename T> | 167 template <typename T> |
167 struct ThreadingTrait<Supplementable<T>> { | 168 struct ThreadingTrait<Supplementable<T>> { |
168 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 169 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
169 }; | 170 }; |
170 | 171 |
171 } // namespace blink | 172 } // namespace blink |
172 | 173 |
173 #endif // Supplementable_h | 174 #endif // Supplementable_h |
OLD | NEW |