Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: sky/engine/bindings-dart/core/dart/DartPersistentValue.cpp

Issue 875013003: Import Dart bindings as of Blink r188698. This merely copies the files over and does not attach any… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+}
« no previous file with comments | « sky/engine/bindings-dart/core/dart/DartPersistentValue.h ('k') | sky/engine/bindings-dart/core/dart/DartScheduledAction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698