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

Unified Diff: sky/engine/bindings-dart/core/dart/DartScriptPromise.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/DartScriptPromise.cpp
diff --git a/sky/engine/bindings-dart/core/dart/DartScriptPromise.cpp b/sky/engine/bindings-dart/core/dart/DartScriptPromise.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b2cf7496fc759d3fdb163fae50eb50f121ab6136
--- /dev/null
+++ b/sky/engine/bindings-dart/core/dart/DartScriptPromise.cpp
@@ -0,0 +1,45 @@
+// 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 "config.h"
+#include "bindings/core/dart/DartScriptPromise.h"
+
+#include "bindings/common/ExceptionMessages.h"
+#include "bindings/common/ExceptionState.h"
+#include "bindings/core/dart/DartUtilities.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8ThrowException.h"
+#include "core/dom/DOMException.h"
+#include <v8.h>
+
+namespace blink {
+
+DartScriptPromise::DartScriptPromise(DartScriptState* scriptState, Dart_Handle future)
+ : m_scriptState(scriptState)
+ , m_value(future)
+{
+ if (!future)
+ return;
+
+ if (!Dart_IsFuture(future)) {
+ m_value.clear();
+ // FIXMEDART: How do we do a sticky error?
+ Dart_Handle coreLib = Dart_LookupLibrary(Dart_NewStringFromCString("dart:core"));
+ Dart_Handle errorClass = Dart_GetType(coreLib, DartUtilities::stringToDart((String)"ArgumentError"), 0, 0);
+ Dart_Handle dartMessage = DartUtilities::stringToDart((String)"the given value is not a Future");
+ Dart_Handle error = Dart_New(errorClass, Dart_NewStringFromCString(""), 1, &dartMessage);
+ Dart_ThrowException(error);
+ ASSERT_NOT_REACHED();
+ return;
+ }
+}
+
+PassRefPtr<AbstractScriptPromise> DartScriptPromise::then(PassOwnPtr<ScriptFunction> onFulfilled, PassOwnPtr<ScriptFunction> onRejected)
+{
+ // FIXMEDART: Implement.
+ RELEASE_ASSERT_NOT_REACHED();
+ return nullptr;
+}
+
+} // namespace blink
« no previous file with comments | « sky/engine/bindings-dart/core/dart/DartScriptPromise.h ('k') | sky/engine/bindings-dart/core/dart/DartScriptPromiseResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698