| 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..af8be01b7ad8604050131512dbe892bd68faf118 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/ThreadState.h"
|
|
|
| namespace WebCore {
|
|
|
| -AXSVGRoot::AXSVGRoot(RenderObject* renderer)
|
| - : 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
|
|
|