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

Side by Side Diff: sky/engine/bindings2/mojo_natives.cc

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « sky/engine/bindings2/dart_callback.cc ('k') | sky/engine/build/scripts/name_macros.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h"
6 #include "sky/engine/bindings2/mojo_natives.h"
7
5 #include <stdio.h> 8 #include <stdio.h>
6 #include <string.h> 9 #include <string.h>
7 #include <vector> 10 #include <vector>
8 11
9 #include "base/logging.h" 12 #include "base/logging.h"
10 #include "base/macros.h" 13 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "builtin.h"
13 #include "dart/runtime/include/dart_api.h" 15 #include "dart/runtime/include/dart_api.h"
14 #include "mojo/public/c/system/core.h" 16 #include "mojo/public/c/system/core.h"
15 #include "mojo/public/cpp/system/core.h" 17 #include "mojo/public/cpp/system/core.h"
18 #include "sky/engine/bindings2/builtin.h"
19 #include "sky/engine/tonic/dart_converter.h"
20 #include "sky/engine/tonic/dart_builtin.h"
16 21
17 namespace blink { 22 namespace blink {
18 23
19 #define REGISTER_FUNCTION(name, count) \ 24 #define REGISTER_FUNCTION(name, count) \
20 { "" #name, name, count }, 25 { "" #name, name, count },
21 #define DECLARE_FUNCTION(name, count) \ 26 #define DECLARE_FUNCTION(name, count) \
22 extern void name(Dart_NativeArguments args); 27 extern void name(Dart_NativeArguments args);
23 28
24 #define MOJO_NATIVE_LIST(V) \ 29 #define MOJO_NATIVE_LIST(V) \
25 V(MojoSharedBuffer_Create, 2) \ 30 V(MojoSharedBuffer_Create, 2) \
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static void SetNullReturn(Dart_NativeArguments arguments) { 92 static void SetNullReturn(Dart_NativeArguments arguments) {
88 Dart_SetReturnValue(arguments, Dart_Null()); 93 Dart_SetReturnValue(arguments, Dart_Null());
89 } 94 }
90 95
91 static void SetInvalidArgumentReturn(Dart_NativeArguments arguments) { 96 static void SetInvalidArgumentReturn(Dart_NativeArguments arguments) {
92 Dart_SetIntegerReturnValue( 97 Dart_SetIntegerReturnValue(
93 arguments, static_cast<int64_t>(MOJO_RESULT_INVALID_ARGUMENT)); 98 arguments, static_cast<int64_t>(MOJO_RESULT_INVALID_ARGUMENT));
94 } 99 }
95 100
96 static Dart_Handle MojoLib() { 101 static Dart_Handle MojoLib() {
97 return DartBuiltins::LookupLibrary("dart:mojo_core"); 102 return DartBuiltin::LookupLibrary("dart:mojo_core");
98 } 103 }
99 104
100 static Dart_Handle SignalsStateToDart(Dart_Handle klass, 105 static Dart_Handle SignalsStateToDart(Dart_Handle klass,
101 const MojoHandleSignalsState& state) { 106 const MojoHandleSignalsState& state) {
102 Dart_Handle arg1 = Dart_NewInteger(state.satisfied_signals); 107 Dart_Handle arg1 = Dart_NewInteger(state.satisfied_signals);
103 Dart_Handle arg2 = Dart_NewInteger(state.satisfiable_signals); 108 Dart_Handle arg2 = Dart_NewInteger(state.satisfiable_signals);
104 Dart_Handle args[] = {arg1, arg2}; 109 Dart_Handle args[] = {arg1, arg2};
105 return Dart_New(klass, Dart_Null(), 2, args); 110 return Dart_New(klass, Dart_Null(), 2, args);
106 } 111 }
107 112
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 CHECK_INTEGER_ARGUMENT(arguments, 0, &control_handle, InvalidArgument); 800 CHECK_INTEGER_ARGUMENT(arguments, 0, &control_handle, InvalidArgument);
796 mojo_control_handle = control_handle; 801 mojo_control_handle = control_handle;
797 Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(MOJO_RESULT_OK)); 802 Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(MOJO_RESULT_OK));
798 } 803 }
799 804
800 void MojoHandleWatcher_GetControlHandle(Dart_NativeArguments arguments) { 805 void MojoHandleWatcher_GetControlHandle(Dart_NativeArguments arguments) {
801 Dart_SetIntegerReturnValue(arguments, mojo_control_handle); 806 Dart_SetIntegerReturnValue(arguments, mojo_control_handle);
802 } 807 }
803 808
804 } // namespace blink 809 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings2/dart_callback.cc ('k') | sky/engine/build/scripts/name_macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698