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

Unified Diff: sky/engine/bindings2/scheduled_action.cc

Issue 918333002: Add the c++ code part of bindings2/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updated per earlier reviews Created 5 years, 10 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/bindings2/scheduled_action.cc
diff --git a/sky/engine/bindings2/scheduled_action.cc b/sky/engine/bindings2/scheduled_action.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4a9f0496412adea28eeba77f465daecac17570db
--- /dev/null
+++ b/sky/engine/bindings2/scheduled_action.cc
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sky/engine/config.h"
+#include "sky/engine/bindings2/scheduled_action.h"
+
+#include "sky/engine/tonic/dart_api_scope.h"
+#include "sky/engine/tonic/dart_error.h"
+#include "sky/engine/tonic/dart_isolate_scope.h"
+
+namespace blink {
+
+ScheduledAction::ScheduledAction(DartState* dart_state, Dart_Handle closure)
+ : closure_(dart_state, closure) {
+ DCHECK(Dart_IsClosure(closure));
+}
+
+ScheduledAction::~ScheduledAction() {
+}
+
+void ScheduledAction::Execute(ExecutionContext*) {
+ if (!closure_.dart_state())
+ return;
+ DartIsolateScope scope(closure_.dart_state()->isolate());
+ DartApiScope api_scope;
+ LogIfError(Dart_InvokeClosure(closure_.value(), 0, nullptr));
+}
+
+} // namespace blink
« no previous file with comments | « sky/engine/bindings2/scheduled_action.h ('k') | sky/engine/bindings2/scripts/templates/attributes_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698