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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ExecutionContextTask() { } | 44 ExecutionContextTask() { } |
45 virtual ~ExecutionContextTask() { } | 45 virtual ~ExecutionContextTask() { } |
46 virtual void performTask(ExecutionContext*) = 0; | 46 virtual void performTask(ExecutionContext*) = 0; |
47 // Certain tasks get marked specially so that they aren't discarded, and are
executed, when the context is shutting down its message queue. | 47 // Certain tasks get marked specially so that they aren't discarded, and are
executed, when the context is shutting down its message queue. |
48 virtual bool isCleanupTask() const { return false; } | 48 virtual bool isCleanupTask() const { return false; } |
49 virtual const String& taskNameForInstrumentation() const { return emptyStrin
g(); } | 49 virtual const String& taskNameForInstrumentation() const { return emptyStrin
g(); } |
50 }; | 50 }; |
51 | 51 |
52 class CallClosureTask FINAL : public ExecutionContextTask { | 52 class CallClosureTask FINAL : public ExecutionContextTask { |
53 public: | 53 public: |
| 54 // Do not use |create| other than in createCrossThreadTask. |
| 55 // See http://crbug.com/390851 |
54 static PassOwnPtr<CallClosureTask> create(const Closure& closure) | 56 static PassOwnPtr<CallClosureTask> create(const Closure& closure) |
55 { | 57 { |
56 return adoptPtr(new CallClosureTask(closure)); | 58 return adoptPtr(new CallClosureTask(closure)); |
57 } | 59 } |
58 virtual void performTask(ExecutionContext*) OVERRIDE { m_closure(); } | 60 virtual void performTask(ExecutionContext*) OVERRIDE { m_closure(); } |
59 | 61 |
60 private: | 62 private: |
61 explicit CallClosureTask(const Closure& closure) : m_closure(closure) { } | 63 explicit CallClosureTask(const Closure& closure) : m_closure(closure) { } |
62 Closure m_closure; | 64 Closure m_closure; |
63 }; | 65 }; |
64 | 66 |
65 } // namespace | 67 } // namespace |
66 | 68 |
67 #endif | 69 #endif |
OLD | NEW |