OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009-2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009-2010 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 class CallClosureWithExecutionContextTask final : public CallClosureTaskBase<voi
d(ExecutionContext*)> { | 94 class CallClosureWithExecutionContextTask final : public CallClosureTaskBase<voi
d(ExecutionContext*)> { |
95 public: | 95 public: |
96 // Do not use |create| other than in createCrossThreadTask and | 96 // Do not use |create| other than in createCrossThreadTask and |
97 // createSameThreadTask. | 97 // createSameThreadTask. |
98 // See http://crbug.com/390851 | 98 // See http://crbug.com/390851 |
99 static PassOwnPtr<CallClosureWithExecutionContextTask> create(PassOwnPtr<Fun
ction<void(ExecutionContext*)>> closure, bool isSameThread = false) | 99 static PassOwnPtr<CallClosureWithExecutionContextTask> create(PassOwnPtr<Fun
ction<void(ExecutionContext*)>> closure, bool isSameThread = false) |
100 { | 100 { |
101 return adoptPtr(new CallClosureWithExecutionContextTask(closure, isSameT
hread)); | 101 return adoptPtr(new CallClosureWithExecutionContextTask(closure, isSameT
hread)); |
102 } | 102 } |
103 | 103 |
104 virtual void performTask(ExecutionContext* context) override | 104 void performTask(ExecutionContext* context) override |
105 { | 105 { |
106 checkThread(); | 106 checkThread(); |
107 (*m_closure)(context); | 107 (*m_closure)(context); |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 CallClosureWithExecutionContextTask(PassOwnPtr<Function<void(ExecutionContex
t*)>> closure, bool isSameThread) | 111 CallClosureWithExecutionContextTask(PassOwnPtr<Function<void(ExecutionContex
t*)>> closure, bool isSameThread) |
112 : CallClosureTaskBase<void(ExecutionContext*)>(closure, isSameThread) | 112 : CallClosureTaskBase<void(ExecutionContext*)>(closure, isSameThread) |
113 { | 113 { |
114 } | 114 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 template<typename C, typename... P, typename... MP, | 167 template<typename C, typename... P, typename... MP, |
168 typename RETTYPE = PassOwnPtr<ExecutionContextTask>, size_t PS = sizeof...(P
), size_t MPS = sizeof...(MP)> | 168 typename RETTYPE = PassOwnPtr<ExecutionContextTask>, size_t PS = sizeof...(P
), size_t MPS = sizeof...(MP)> |
169 typename WTF::EnableIf<PS == MPS + 1, RETTYPE>::Type createCrossThreadTask(void
(C::*function)(MP...), const P&... parameters) | 169 typename WTF::EnableIf<PS == MPS + 1, RETTYPE>::Type createCrossThreadTask(void
(C::*function)(MP...), const P&... parameters) |
170 { | 170 { |
171 return internal::CallClosureTask::create(threadSafeBind(function, parameters
...)); | 171 return internal::CallClosureTask::create(threadSafeBind(function, parameters
...)); |
172 } | 172 } |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
175 | 175 |
176 #endif // CrossThreadTask_h | 176 #endif // CrossThreadTask_h |
OLD | NEW |