Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/scheduler/CancellableTaskFactory.h" | 6 #include "platform/scheduler/CancellableTaskFactory.h" |
| 7 | 7 |
| 8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
| 9 #include "wtf/InstanceCounter.h" | 9 #include "wtf/InstanceCounter.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 void CancellableTaskFactory::cancel() | 13 void CancellableTaskFactory::cancel() |
| 14 { | 14 { |
| 15 m_weakPtrFactory.revokeAll(); | 15 m_weakPtrFactory.revokeAll(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 WebThread::Task* CancellableTaskFactory::cancelAndCreate() | 18 WebThread::Task* CancellableTaskFactory::cancelAndCreate() |
| 19 { | 19 { |
| 20 cancel(); | 20 cancel(); |
| 21 return new CancellableTask(m_weakPtrFactory.createWeakPtr()); | 21 return new CancellableTask(m_weakPtrFactory.createWeakPtr()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 NO_LAZY_SWEEP_SANITIZE_ADDRESS | |
| 24 void CancellableTaskFactory::CancellableTask::run() | 25 void CancellableTaskFactory::CancellableTask::run() |
| 25 { | 26 { |
| 26 if (m_weakPtr.get()) { | 27 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) { |
| 27 Closure* closure = m_weakPtr->m_closure.get(); | 28 #if defined(ADDRESS_SANITIZER) |
| 28 m_weakPtr->m_weakPtrFactory.revokeAll(); | 29 if (taskFactory->m_unpoisonBeforeUpdate) |
|
haraken
2015/06/08 06:51:52
Do we need this condition? I mean, wouldn't it be
sof
2015/06/08 07:04:37
If you do it that way, you will also unpoison non-
haraken
2015/06/08 07:11:10
ah, makes sense. The current CL looks good :)
| |
| 30 ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<unsigned char*>(taskFac tory), sizeof(CancellableTaskFactory)); | |
|
haraken
2015/06/06 15:25:20
Just help me understand: Where can the Cancellable
sof
2015/06/06 15:46:11
Hmm, it's accessed from right here?
Timer's use o
haraken
2015/06/07 16:40:46
This function has NO_LAZY_SWEEP_SANITIZE_ADDRESS.
sof
2015/06/07 17:23:05
That's a leaf-level annotation. OwnPtr::get() is n
haraken
2015/06/07 23:46:24
Thanks, understood.
So the final question would b
| |
| 31 #endif | |
| 32 Closure* closure = taskFactory->m_closure.get(); | |
| 33 taskFactory->m_weakPtrFactory.revokeAll(); | |
| 29 (*closure)(); | 34 (*closure)(); |
| 30 } | 35 } |
| 31 } | 36 } |
| 32 | 37 |
| 33 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |