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

Side by Side Diff: mojo/dart/embedder/vmservice.cc

Issue 1649823002: Roll Dart forward and use the shared vmservice isolate sources + benchmark fixes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 | « mojo/dart/embedder/BUILD.gn ('k') | mojo/dart/embedder/vmservice/loader.dart » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/dart/embedder/vmservice.h" 5 #include "mojo/dart/embedder/vmservice.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "dart/runtime/include/dart_api.h" 8 #include "dart/runtime/include/dart_api.h"
9 #include "mojo/dart/embedder/builtin.h" 9 #include "mojo/dart/embedder/builtin.h"
10 #include "mojo/dart/embedder/common.h" 10 #include "mojo/dart/embedder/common.h"
11 #include "mojo/dart/embedder/dart_controller.h" 11 #include "mojo/dart/embedder/dart_controller.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 namespace dart { 14 namespace dart {
15 15
16 #define RETURN_ERROR_HANDLE(handle) \ 16 #define RETURN_ERROR_HANDLE(handle) \
17 if (Dart_IsError(handle)) { \ 17 if (Dart_IsError(handle)) { \
18 return handle; \ 18 return handle; \
19 } 19 }
20 20
21 #define SHUTDOWN_ON_ERROR(handle) \ 21 #define SHUTDOWN_ON_ERROR(handle) \
22 if (Dart_IsError(handle)) { \ 22 if (Dart_IsError(handle)) { \
23 error_msg_ = strdup(Dart_GetError(handle)); \ 23 error_msg_ = strdup(Dart_GetError(handle)); \
24 Dart_ExitScope(); \ 24 Dart_ExitScope(); \
25 Dart_ShutdownIsolate(); \ 25 Dart_ShutdownIsolate(); \
26 return false; \ 26 return false; \
27 } 27 }
28 28
29 #define kLibrarySourceNamePrefix "/vmservice" 29 #define kLibrarySourceNamePrefix "/vmservice"
30 static const char* kVMServiceIOLibraryScriptResourceName = "main.dart"; 30 static const char* kVMServiceIOLibraryScriptResourceName = "vmservice_io.dart";
31 31
32 struct ResourcesEntry { 32 struct ResourcesEntry {
33 const char* path_; 33 const char* path_;
34 const char* resource_; 34 const char* resource_;
35 int length_; 35 int length_;
36 }; 36 };
37 37
38 extern ResourcesEntry __dart_embedder_service_isolate_resources_[]; 38 extern ResourcesEntry __dart_embedder_service_isolate_resources_[];
39 39
40 class Resources { 40 class Resources {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 struct VmServiceIONativeEntry { 121 struct VmServiceIONativeEntry {
122 const char* name; 122 const char* name;
123 int num_arguments; 123 int num_arguments;
124 Dart_NativeFunction function; 124 Dart_NativeFunction function;
125 }; 125 };
126 126
127 127
128 static VmServiceIONativeEntry _VmServiceIONativeEntries[] = { 128 static VmServiceIONativeEntry _VmServiceIONativeEntries[] = {
129 {"ServiceIsolate_TriggerResourceLoad", 0, ServiceIsolate_TriggerResourceLoad}, 129 {"VMServiceIO_NotifyServerState", 2, ServiceIsolate_NotifyServerState},
130 {"ServiceIsolate_NotifyServerState", 2, ServiceIsolate_NotifyServerState}, 130 {"VMServiceIO_Shutdown", 0, ServiceIsolate_Shutdown },
131 {"ServiceIsolate_Shutdown", 0, ServiceIsolate_Shutdown },
132 }; 131 };
133 132
134 133
135 static Dart_NativeFunction VmServiceIONativeResolver(Dart_Handle name, 134 static Dart_NativeFunction VmServiceIONativeResolver(Dart_Handle name,
136 int num_arguments, 135 int num_arguments,
137 bool* auto_setup_scope) { 136 bool* auto_setup_scope) {
138 const char* function_name = NULL; 137 const char* function_name = NULL;
139 Dart_Handle result = Dart_StringToCString(name, &function_name); 138 Dart_Handle result = Dart_StringToCString(name, &function_name);
140 DCHECK(!Dart_IsError(result)); 139 DCHECK(!Dart_IsError(result));
141 DCHECK(function_name != NULL); 140 DCHECK(function_name != NULL);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 Dart_Handle source = GetSource(url_string); 332 Dart_Handle source = GetSource(url_string);
334 if (Dart_IsError(source)) { 333 if (Dart_IsError(source)) {
335 return source; 334 return source;
336 } 335 }
337 return Dart_LoadSource(library, url, source, 0, 0); 336 return Dart_LoadSource(library, url, source, 0, 0);
338 } 337 }
339 338
340 339
341 } // namespace dart 340 } // namespace dart
342 } // namespace mojo 341 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/dart/embedder/BUILD.gn ('k') | mojo/dart/embedder/vmservice/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698