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

Side by Side Diff: samples/sample_extension/sample_extension.cc

Issue 2651633002: VM: [Kernel] Fix bootstraping when Kernel isolate is used. (Closed)
Patch Set: Landing issue Created 3 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 | « runtime/vm/service_isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 #include <string.h> 4 #include <string.h>
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 srand(seed); 74 srand(seed);
75 for (int i = 0; i < length; ++i) { 75 for (int i = 0; i < length; ++i) {
76 values[i] = rand() % 256; 76 values[i] = rand() % 256;
77 } 77 }
78 return values; 78 return values;
79 } 79 }
80 80
81 81
82 void wrappedRandomArray(Dart_Port dest_port_id, 82 void wrappedRandomArray(Dart_Port dest_port_id,
83 Dart_CObject* message) { 83 Dart_CObject* message,
84 void* peer) {
84 Dart_Port reply_port_id = ILLEGAL_PORT; 85 Dart_Port reply_port_id = ILLEGAL_PORT;
85 if (message->type == Dart_CObject_kArray && 86 if (message->type == Dart_CObject_kArray &&
86 3 == message->value.as_array.length) { 87 3 == message->value.as_array.length) {
87 // Use .as_array and .as_int32 to access the data in the Dart_CObject. 88 // Use .as_array and .as_int32 to access the data in the Dart_CObject.
88 Dart_CObject* param0 = message->value.as_array.values[0]; 89 Dart_CObject* param0 = message->value.as_array.values[0];
89 Dart_CObject* param1 = message->value.as_array.values[1]; 90 Dart_CObject* param1 = message->value.as_array.values[1];
90 Dart_CObject* param2 = message->value.as_array.values[2]; 91 Dart_CObject* param2 = message->value.as_array.values[2];
91 if (param0->type == Dart_CObject_kInt32 && 92 if (param0->type == Dart_CObject_kInt32 &&
92 param1->type == Dart_CObject_kInt32 && 93 param1->type == Dart_CObject_kInt32 &&
93 param2->type == Dart_CObject_kSendPort) { 94 param2->type == Dart_CObject_kSendPort) {
(...skipping 19 matching lines...) Expand all
113 Dart_CObject result; 114 Dart_CObject result;
114 result.type = Dart_CObject_kNull; 115 result.type = Dart_CObject_kNull;
115 Dart_PostCObject(reply_port_id, &result); 116 Dart_PostCObject(reply_port_id, &result);
116 } 117 }
117 118
118 119
119 void randomArrayServicePort(Dart_NativeArguments arguments) { 120 void randomArrayServicePort(Dart_NativeArguments arguments) {
120 Dart_EnterScope(); 121 Dart_EnterScope();
121 Dart_SetReturnValue(arguments, Dart_Null()); 122 Dart_SetReturnValue(arguments, Dart_Null());
122 Dart_Port service_port = 123 Dart_Port service_port =
123 Dart_NewNativePort("RandomArrayService", wrappedRandomArray, true); 124 Dart_NewNativePort("RandomArrayService", wrappedRandomArray, true, NULL);
124 if (service_port != ILLEGAL_PORT) { 125 if (service_port != ILLEGAL_PORT) {
125 Dart_Handle send_port = HandleError(Dart_NewSendPort(service_port)); 126 Dart_Handle send_port = HandleError(Dart_NewSendPort(service_port));
126 Dart_SetReturnValue(arguments, send_port); 127 Dart_SetReturnValue(arguments, send_port);
127 } 128 }
128 Dart_ExitScope(); 129 Dart_ExitScope();
129 } 130 }
130 131
131 132
132 struct FunctionLookup { 133 struct FunctionLookup {
133 const char* name; 134 const char* name;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (strcmp(no_scope_function_list[i].name, cname) == 0) { 180 if (strcmp(no_scope_function_list[i].name, cname) == 0) {
180 *auto_setup_scope = false; 181 *auto_setup_scope = false;
181 result = no_scope_function_list[i].function; 182 result = no_scope_function_list[i].function;
182 break; 183 break;
183 } 184 }
184 } 185 }
185 186
186 Dart_ExitScope(); 187 Dart_ExitScope();
187 return result; 188 return result;
188 } 189 }
OLDNEW
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698