OLD | NEW |
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 "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
6 #include "sky/engine/bindings2/builtin.h" | 6 #include "sky/engine/bindings2/builtin.h" |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "dart/runtime/include/dart_api.h" | 9 #include "dart/runtime/include/dart_api.h" |
10 #include "gen/sky/bindings/DartGlobal.h" | 10 #include "gen/sky/bindings/DartGlobal.h" |
| 11 #include "mojo_natives.h" |
11 #include "sky/engine/bindings2/builtin_natives.h" | 12 #include "sky/engine/bindings2/builtin_natives.h" |
12 #include "sky/engine/bindings2/builtin_sky.h" | 13 #include "sky/engine/bindings2/builtin_sky.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 namespace { | 16 namespace { |
16 | 17 |
17 struct LibraryDescriptor { | 18 struct LibraryDescriptor { |
18 const char* url; | 19 const char* url; |
19 bool has_natives; | 20 bool has_natives; |
20 Dart_NativeEntrySymbol native_symbol; | 21 Dart_NativeEntrySymbol native_symbol; |
21 Dart_NativeEntryResolver native_resolver; | 22 Dart_NativeEntryResolver native_resolver; |
22 }; | 23 }; |
23 | 24 |
24 const LibraryDescriptor kBuiltinLibraries[] = { | 25 const LibraryDescriptor kBuiltinLibraries[] = { |
25 /* { url_, has_natives_, native_symbol_, native_resolver_ } */ | 26 /* { url_, has_natives_, native_symbol_, native_resolver_ } */ |
26 {"dart:sky_builtin", true, BuiltinNatives::NativeSymbol, BuiltinNatives::Nat
iveLookup}, | 27 {"dart:sky_builtin", true, BuiltinNatives::NativeSymbol, BuiltinNatives::Nat
iveLookup}, |
27 {"dart:sky", true, skySnapshotSymbolizer, skySnapshotResolver}, | 28 {"dart:sky", true, skySnapshotSymbolizer, skySnapshotResolver}, |
| 29 {"dart:mojo_bindings", false, nullptr, nullptr}, |
| 30 {"dart:mojo_core", true, MojoNativeSymbol, MojoNativeLookup}, |
28 }; | 31 }; |
29 | 32 |
30 } // namespace | 33 } // namespace |
31 | 34 |
32 void Builtin::SetNativeResolver(BuiltinLibraryId id) { | 35 void Builtin::SetNativeResolver(BuiltinLibraryId id) { |
33 static_assert(arraysize(kBuiltinLibraries) == kInvalidLibrary, | 36 static_assert(arraysize(kBuiltinLibraries) == kInvalidLibrary, |
34 "Unexpected number of builtin libraries"); | 37 "Unexpected number of builtin libraries"); |
35 DCHECK_GE(id, kBuiltinLibrary); | 38 DCHECK_GE(id, kBuiltinLibrary); |
36 DCHECK_LT(id, kInvalidLibrary); | 39 DCHECK_LT(id, kInvalidLibrary); |
37 if (kBuiltinLibraries[id].has_natives) { | 40 if (kBuiltinLibraries[id].has_natives) { |
(...skipping 13 matching lines...) Expand all Loading... |
51 "Unexpected number of builtin libraries"); | 54 "Unexpected number of builtin libraries"); |
52 DCHECK_GE(id, kBuiltinLibrary); | 55 DCHECK_GE(id, kBuiltinLibrary); |
53 DCHECK_LT(id, kInvalidLibrary); | 56 DCHECK_LT(id, kInvalidLibrary); |
54 Dart_Handle url = Dart_NewStringFromCString(kBuiltinLibraries[id].url); | 57 Dart_Handle url = Dart_NewStringFromCString(kBuiltinLibraries[id].url); |
55 Dart_Handle library = Dart_LookupLibrary(url); | 58 Dart_Handle library = Dart_LookupLibrary(url); |
56 DART_CHECK_VALID(library); | 59 DART_CHECK_VALID(library); |
57 return library; | 60 return library; |
58 } | 61 } |
59 | 62 |
60 } // namespace blink | 63 } // namespace blink |
OLD | NEW |