| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 ~MainThreadTaskRunner(); | 53 ~MainThreadTaskRunner(); |
| 54 | 54 |
| 55 DECLARE_TRACE(); | 55 DECLARE_TRACE(); |
| 56 | 56 |
| 57 // Executes the task on context's thread asynchronously. | 57 // Executes the task on context's thread asynchronously. |
| 58 void postTask(const WebTraceLocation&, | 58 void postTask(const WebTraceLocation&, |
| 59 std::unique_ptr<ExecutionContextTask>, | 59 std::unique_ptr<ExecutionContextTask>, |
| 60 const String& taskNameForInstrumentation = emptyString()); | 60 const String& taskNameForInstrumentation = emptyString()); |
| 61 | 61 |
| 62 void postInspectorTask(const WebTraceLocation&, | |
| 63 std::unique_ptr<ExecutionContextTask>); | |
| 64 void perform(std::unique_ptr<ExecutionContextTask>, | 62 void perform(std::unique_ptr<ExecutionContextTask>, |
| 65 bool isInspectorTask, | |
| 66 bool instrumenting); | 63 bool instrumenting); |
| 67 | 64 |
| 68 void suspend(); | 65 void suspend(); |
| 69 void resume(); | 66 void resume(); |
| 70 | 67 |
| 71 private: | 68 private: |
| 72 explicit MainThreadTaskRunner(ExecutionContext*); | 69 explicit MainThreadTaskRunner(ExecutionContext*); |
| 73 | 70 |
| 74 void pendingTasksTimerFired(TimerBase*); | 71 void pendingTasksTimerFired(TimerBase*); |
| 75 | 72 |
| 76 void postTaskInternal(const WebTraceLocation&, | |
| 77 std::unique_ptr<ExecutionContextTask>, | |
| 78 bool isInspectorTask, | |
| 79 bool instrumenting); | |
| 80 | |
| 81 // Untraced back reference to the owner Document; | 73 // Untraced back reference to the owner Document; |
| 82 // this object has identical lifetime to it. | 74 // this object has identical lifetime to it. |
| 83 UntracedMember<ExecutionContext> m_context; | 75 UntracedMember<ExecutionContext> m_context; |
| 84 Timer<MainThreadTaskRunner> m_pendingTasksTimer; | 76 Timer<MainThreadTaskRunner> m_pendingTasksTimer; |
| 85 Vector<std::pair<std::unique_ptr<ExecutionContextTask>, | 77 Vector<std::pair<std::unique_ptr<ExecutionContextTask>, |
| 86 bool /* instrumenting */>> | 78 bool /* instrumenting */>> |
| 87 m_pendingTasks; | 79 m_pendingTasks; |
| 88 bool m_suspended; | 80 bool m_suspended; |
| 89 WeakPtrFactory<MainThreadTaskRunner> m_weakFactory; | 81 WeakPtrFactory<MainThreadTaskRunner> m_weakFactory; |
| 90 WeakPtr<MainThreadTaskRunner> m_weakPtr; | 82 WeakPtr<MainThreadTaskRunner> m_weakPtr; |
| 91 }; | 83 }; |
| 92 | 84 |
| 93 inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create( | 85 inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create( |
| 94 ExecutionContext* context) { | 86 ExecutionContext* context) { |
| 95 return wrapUnique(new MainThreadTaskRunner(context)); | 87 return wrapUnique(new MainThreadTaskRunner(context)); |
| 96 } | 88 } |
| 97 | 89 |
| 98 } // namespace blink | 90 } // namespace blink |
| 99 | 91 |
| 100 #endif | 92 #endif |
| OLD | NEW |