Chromium Code Reviews| Index: Source/platform/TaskSynchronizer.cpp |
| diff --git a/Source/core/accessibility/AXSVGRoot.cpp b/Source/platform/TaskSynchronizer.cpp |
| similarity index 66% |
| copy from Source/core/accessibility/AXSVGRoot.cpp |
| copy to Source/platform/TaskSynchronizer.cpp |
| index 7c2efa2cc2e7149c76eef89f21f5e3a3d61f57e0..01680215bf691d0f2f2da7a2b2e39f64dea2f9f9 100644 |
| --- a/Source/core/accessibility/AXSVGRoot.cpp |
| +++ b/Source/platform/TaskSynchronizer.cpp |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2012 Apple Inc. All rights reserved. |
| + * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| @@ -27,35 +27,37 @@ |
| */ |
| #include "config.h" |
| -#include "core/accessibility/AXSVGRoot.h" |
| +#include "platform/TaskSynchronizer.h" |
| +#include "heap/Handle.h" |
| namespace WebCore { |
| -AXSVGRoot::AXSVGRoot(RenderObject* renderer) |
|
tkent
2014/03/13 07:43:51
Git chose a wrong copy source.
We should land a CL
|
| - : AXRenderObject(renderer) |
| - , m_parent(0) |
| +TaskSynchronizer::TaskSynchronizer() |
| + : m_taskCompleted(false) |
| +#ifndef NDEBUG |
| + , m_hasCheckedForTermination(false) |
| +#endif |
| { |
| } |
| -AXSVGRoot::~AXSVGRoot() |
| +void TaskSynchronizer::waitForTaskCompletion() |
| { |
| + // Prevent the deadlock between park request by other threads and blocking |
| + // by m_synchronousCondition. |
| + ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); |
| + m_synchronousMutex.lock(); |
| + while (!m_taskCompleted) |
| + m_synchronousCondition.wait(m_synchronousMutex); |
| + m_synchronousMutex.unlock(); |
| } |
| -PassRefPtr<AXSVGRoot> AXSVGRoot::create(RenderObject* renderer) |
| +void TaskSynchronizer::taskCompleted() |
| { |
| - return adoptRef(new AXSVGRoot(renderer)); |
| + m_synchronousMutex.lock(); |
| + m_taskCompleted = true; |
| + m_synchronousCondition.signal(); |
| + m_synchronousMutex.unlock(); |
| } |
| -AXObject* AXSVGRoot::parentObject() const |
| -{ |
| - // If a parent was set because this is a remote SVG resource, use that |
| - // but otherwise, we should rely on the standard render tree for the parent. |
| - if (m_parent) |
| - return m_parent; |
| - |
| - return AXRenderObject::parentObject(); |
| -} |
| - |
| - |
| } // namespace WebCore |