| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/dom/ExecutionContextTask.h" | 30 #include "core/dom/ExecutionContextTask.h" |
| 31 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
| 32 #include "public/platform/Platform.h" | 32 #include "public/platform/Platform.h" |
| 33 #include "wtf/Assertions.h" | 33 #include "wtf/Assertions.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class MainThreadTask : public WebTaskRunner::Task { | 37 class MainThreadTask : public WebTaskRunner::Task { |
| 38 WTF_MAKE_NONCOPYABLE(MainThreadTask); USING_FAST_MALLOC(MainThreadTask); | 38 WTF_MAKE_NONCOPYABLE(MainThreadTask); USING_FAST_MALLOC(MainThreadTask); |
| 39 public: | 39 public: |
| 40 MainThreadTask(WeakPtrWillBeRawPtr<MainThreadTaskRunner> runner, PassOwnPtr<
ExecutionContextTask> task, bool isInspectorTask) | 40 MainThreadTask(RawPtr<MainThreadTaskRunner> runner, PassOwnPtr<ExecutionCont
extTask> task, bool isInspectorTask) |
| 41 : m_runner(runner) | 41 : m_runner(runner) |
| 42 , m_task(task) | 42 , m_task(task) |
| 43 , m_isInspectorTask(isInspectorTask) | 43 , m_isInspectorTask(isInspectorTask) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void run() override; | 47 void run() override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 WeakPtrWillBeCrossThreadWeakPersistent<MainThreadTaskRunner> m_runner; | 50 CrossThreadWeakPersistent<MainThreadTaskRunner> m_runner; |
| 51 OwnPtr<ExecutionContextTask> m_task; | 51 OwnPtr<ExecutionContextTask> m_task; |
| 52 bool m_isInspectorTask; | 52 bool m_isInspectorTask; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 void MainThreadTask::run() | 55 void MainThreadTask::run() |
| 56 { | 56 { |
| 57 ASSERT(isMainThread()); | 57 ASSERT(isMainThread()); |
| 58 | 58 |
| 59 if (!m_runner.get()) | 59 if (!m_runner.get()) |
| 60 return; | 60 return; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 m_pendingTasks.remove(0); | 130 m_pendingTasks.remove(0); |
| 131 const bool instrumenting = !task->taskNameForInstrumentation().isEmpty()
; | 131 const bool instrumenting = !task->taskNameForInstrumentation().isEmpty()
; |
| 132 if (instrumenting) | 132 if (instrumenting) |
| 133 InspectorInstrumentation::willPerformExecutionContextTask(m_context,
task.get()); | 133 InspectorInstrumentation::willPerformExecutionContextTask(m_context,
task.get()); |
| 134 task->performTask(m_context); | 134 task->performTask(m_context); |
| 135 if (instrumenting) | 135 if (instrumenting) |
| 136 InspectorInstrumentation::didPerformExecutionContextTask(m_context); | 136 InspectorInstrumentation::didPerformExecutionContextTask(m_context); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 WeakPtrWillBeRawPtr<MainThreadTaskRunner> MainThreadTaskRunner::createWeakPointe
rToSelf() | 140 RawPtr<MainThreadTaskRunner> MainThreadTaskRunner::createWeakPointerToSelf() |
| 141 { | 141 { |
| 142 #if ENABLE(OILPAN) | 142 #if ENABLE(OILPAN) |
| 143 return this; | 143 return this; |
| 144 #else | 144 #else |
| 145 return m_weakFactory.createWeakPtr(); | 145 return m_weakFactory.createWeakPtr(); |
| 146 #endif | 146 #endif |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |