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

Unified Diff: sky/engine/bindings2/mojo_natives.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
« no previous file with comments | « sky/engine/bindings2/mojo_natives.h ('k') | sky/engine/bindings2/nullable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings2/mojo_natives.cc
diff --git a/mojo/dart/embedder/mojo_natives.cc b/sky/engine/bindings2/mojo_natives.cc
similarity index 97%
copy from mojo/dart/embedder/mojo_natives.cc
copy to sky/engine/bindings2/mojo_natives.cc
index ad8251a3dd69aec7e3ff6c96572bb95e2193e169..6a853f21010527973b24adb4be79f638f350289d 100644
--- a/mojo/dart/embedder/mojo_natives.cc
+++ b/sky/engine/bindings2/mojo_natives.cc
@@ -9,13 +9,17 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "builtin.h"
#include "dart/runtime/include/dart_api.h"
-#include "mojo/dart/embedder/builtin.h"
#include "mojo/public/c/system/core.h"
#include "mojo/public/cpp/system/core.h"
-namespace mojo {
-namespace dart {
+namespace blink {
+
+#define REGISTER_FUNCTION(name, count) \
+ { "" #name, name, count },
+#define DECLARE_FUNCTION(name, count) \
+ extern void name(Dart_NativeArguments args);
#define MOJO_NATIVE_LIST(V) \
V(MojoSharedBuffer_Create, 2) \
@@ -90,8 +94,7 @@ static void SetInvalidArgumentReturn(Dart_NativeArguments arguments) {
}
static Dart_Handle MojoLib() {
- Dart_Handle core_lib_name = Dart_NewStringFromCString("dart:mojo_core");
- return Dart_LookupLibrary(core_lib_name);
+ return DartBuiltins::LookupLibrary("dart:mojo_core");
}
static Dart_Handle SignalsStateToDart(Dart_Handle klass,
@@ -142,14 +145,14 @@ void MojoHandle_Register(Dart_NativeArguments arguments) {
// on the existence of the right fields to be sufficient.
Dart_Handle raw_mojo_handle_instance = Dart_GetField(
- mojo_handle_instance, Dart_NewStringFromCString("_handle"));
+ mojo_handle_instance, ToDart("_handle"));
if (Dart_IsError(raw_mojo_handle_instance)) {
SetInvalidArgumentReturn(arguments);
return;
}
Dart_Handle mojo_handle = Dart_GetField(
- raw_mojo_handle_instance, Dart_NewStringFromCString("h"));
+ raw_mojo_handle_instance, ToDart("h"));
if (Dart_IsError(mojo_handle)) {
SetInvalidArgumentReturn(arguments);
return;
@@ -199,7 +202,7 @@ void MojoHandle_Wait(Dart_NativeArguments arguments) {
static_cast<MojoDeadline>(deadline), &state);
Dart_Handle klass = Dart_GetClass(
- MojoLib(), Dart_NewStringFromCString("MojoHandleSignalsState"));
+ MojoLib(), ToDart("MojoHandleSignalsState"));
DART_CHECK_VALID(klass);
// The return value is structured as a list of length 2:
@@ -258,7 +261,7 @@ void MojoHandle_WaitMany(Dart_NativeArguments arguments) {
mojo_handles, mojo_signals, static_cast<MojoDeadline>(deadline), &states);
Dart_Handle klass = Dart_GetClass(
- MojoLib(), Dart_NewStringFromCString("MojoHandleSignalsState"));
+ MojoLib(), ToDart("MojoHandleSignalsState"));
DART_CHECK_VALID(klass);
// The return value is structured as a list of length 3:
@@ -798,5 +801,4 @@ void MojoHandleWatcher_GetControlHandle(Dart_NativeArguments arguments) {
Dart_SetIntegerReturnValue(arguments, mojo_control_handle);
}
-} // namespace dart
-} // namespace mojo
+} // namespace blink
« no previous file with comments | « sky/engine/bindings2/mojo_natives.h ('k') | sky/engine/bindings2/nullable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698