| 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 std::unique_ptr<Function<void(ExecutionContext*), threadAffinity>> closure, | 64 std::unique_ptr<Function<void(ExecutionContext*), threadAffinity>> closure, |
| 65 ExecutionContext* executionContext) { | 65 ExecutionContext* executionContext) { |
| 66 (*closure)(executionContext); | 66 (*closure)(executionContext); |
| 67 } | 67 } |
| 68 | 68 |
| 69 template <typename T, WTF::FunctionThreadAffinity threadAffinity> | 69 template <typename T, WTF::FunctionThreadAffinity threadAffinity> |
| 70 class CallClosureTask final : public ExecutionContextTask { | 70 class CallClosureTask final : public ExecutionContextTask { |
| 71 public: | 71 public: |
| 72 static std::unique_ptr<CallClosureTask> create( | 72 static std::unique_ptr<CallClosureTask> create( |
| 73 std::unique_ptr<Function<T, threadAffinity>> closure) { | 73 std::unique_ptr<Function<T, threadAffinity>> closure) { |
| 74 return wrapUnique(new CallClosureTask(std::move(closure))); | 74 return WTF::wrapUnique(new CallClosureTask(std::move(closure))); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 explicit CallClosureTask(std::unique_ptr<Function<T, threadAffinity>> closure) | 78 explicit CallClosureTask(std::unique_ptr<Function<T, threadAffinity>> closure) |
| 79 : m_closure(std::move(closure)) {} | 79 : m_closure(std::move(closure)) {} |
| 80 | 80 |
| 81 void performTask(ExecutionContext* executionContext) override { | 81 void performTask(ExecutionContext* executionContext) override { |
| 82 runCallClosureTask(std::move(m_closure), executionContext); | 82 runCallClosureTask(std::move(m_closure), executionContext); |
| 83 } | 83 } |
| 84 | 84 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::unique_ptr<ExecutionContextTask> createCrossThreadTask( | 157 std::unique_ptr<ExecutionContextTask> createCrossThreadTask( |
| 158 FunctionType function, | 158 FunctionType function, |
| 159 P&&... parameters) { | 159 P&&... parameters) { |
| 160 return internal::createCallClosureTask( | 160 return internal::createCallClosureTask( |
| 161 crossThreadBind(function, std::forward<P>(parameters)...)); | 161 crossThreadBind(function, std::forward<P>(parameters)...)); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace blink | 164 } // namespace blink |
| 165 | 165 |
| 166 #endif | 166 #endif |
| OLD | NEW |