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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class ExecutionContext; | 39 class ExecutionContext; |
40 | 40 |
41 class CORE_EXPORT ExecutionContextTask { | 41 class CORE_EXPORT ExecutionContextTask { |
42 WTF_MAKE_NONCOPYABLE(ExecutionContextTask); | 42 WTF_MAKE_NONCOPYABLE(ExecutionContextTask); |
43 USING_FAST_MALLOC(ExecutionContextTask); | 43 USING_FAST_MALLOC(ExecutionContextTask); |
44 public: | 44 public: |
45 ExecutionContextTask() { } | 45 ExecutionContextTask() { } |
46 virtual ~ExecutionContextTask() { } | 46 virtual ~ExecutionContextTask() { } |
47 virtual void performTask(ExecutionContext*) = 0; | 47 virtual void performTask(ExecutionContext*) = 0; |
48 virtual String taskNameForInstrumentation() const { return String(); } | |
49 }; | 48 }; |
50 | 49 |
51 namespace internal { | 50 namespace internal { |
52 | 51 |
53 template<WTF::FunctionThreadAffinity threadAffinity> | 52 template<WTF::FunctionThreadAffinity threadAffinity> |
54 void runCallClosureTask(std::unique_ptr<Function<void(), threadAffinity>> closur
e, ExecutionContext*) | 53 void runCallClosureTask(std::unique_ptr<Function<void(), threadAffinity>> closur
e, ExecutionContext*) |
55 { | 54 { |
56 (*closure)(); | 55 (*closure)(); |
57 } | 56 } |
58 | 57 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 template<typename FunctionType, typename... P> | 102 template<typename FunctionType, typename... P> |
104 std::unique_ptr<ExecutionContextTask> createSameThreadTask( | 103 std::unique_ptr<ExecutionContextTask> createSameThreadTask( |
105 FunctionType function, P&&... parameters) | 104 FunctionType function, P&&... parameters) |
106 { | 105 { |
107 return internal::createCallClosureTask(WTF::bind(function, std::forward<P>(p
arameters)...)); | 106 return internal::createCallClosureTask(WTF::bind(function, std::forward<P>(p
arameters)...)); |
108 } | 107 } |
109 | 108 |
110 } // namespace blink | 109 } // namespace blink |
111 | 110 |
112 #endif | 111 #endif |
OLD | NEW |