| Index: sky/engine/bindings-dart/core/dart/DartPersistentValue.cpp
|
| diff --git a/sky/engine/platform/exported/Platform.cpp b/sky/engine/bindings-dart/core/dart/DartPersistentValue.cpp
|
| similarity index 74%
|
| copy from sky/engine/platform/exported/Platform.cpp
|
| copy to sky/engine/bindings-dart/core/dart/DartPersistentValue.cpp
|
| index 61872fbe9498df012e4da6f4c859fd8ac76a8b4d..400f2f00e925e36f55a1b81a208711551570e7f6 100644
|
| --- a/sky/engine/platform/exported/Platform.cpp
|
| +++ b/sky/engine/bindings-dart/core/dart/DartPersistentValue.cpp
|
| @@ -27,27 +27,35 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| +#include "config.h"
|
| +#include "bindings/core/dart/DartPersistentValue.h"
|
|
|
| -#include "sky/engine/config.h"
|
| -#include "sky/engine/public/platform/Platform.h"
|
| +#include "bindings/core/dart/DartDOMData.h"
|
| +#include "bindings/core/dart/DartUtilities.h"
|
|
|
| namespace blink {
|
|
|
| -static Platform* s_platform = 0;
|
| -
|
| -void Platform::initialize(Platform* platform)
|
| +DartPersistentValue::DartPersistentValue(Dart_Handle value)
|
| {
|
| - s_platform = platform;
|
| + m_value = Dart_NewPersistentHandle(value);
|
| }
|
|
|
| -void Platform::shutdown()
|
| +DartPersistentValue::~DartPersistentValue()
|
| {
|
| - s_platform = 0;
|
| + clear();
|
| }
|
|
|
| -Platform* Platform::current()
|
| +void DartPersistentValue::clear()
|
| {
|
| - return s_platform;
|
| + if (!isIsolateAlive())
|
| + return;
|
| +
|
| + if (!m_value)
|
| + return;
|
| +
|
| + DartIsolateScope scope(isolate());
|
| + Dart_DeletePersistentHandle(m_value);
|
| + m_value = 0;
|
| }
|
|
|
| -} // namespace blink
|
| +}
|
|
|