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

Side by Side Diff: runtime/bin/builtin_nolib.cc

Issue 2480793002: clang-format runtime/bin (Closed)
Patch Set: Created 4 years, 1 month 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/bin/builtin_natives.cc ('k') | runtime/bin/crypto.h » ('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 (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 4
5 #include <stdio.h> 5 #include <stdio.h>
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
11 #include "bin/io_natives.h" 11 #include "bin/io_natives.h"
12 12
13 namespace dart { 13 namespace dart {
14 namespace bin { 14 namespace bin {
15 15
16 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { 16 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
17 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */ 17 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */
18 { DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true }, 18 {DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true},
19 { DartUtils::kIOLibURL, NULL, NULL, NULL, true }, 19 {DartUtils::kIOLibURL, NULL, NULL, NULL, true},
20 20
21 // End marker. 21 // End marker.
22 { NULL, NULL, NULL, NULL, false } 22 {NULL, NULL, NULL, NULL, false}};
23 };
24 23
25 Dart_Port Builtin::load_port_ = ILLEGAL_PORT; 24 Dart_Port Builtin::load_port_ = ILLEGAL_PORT;
26 const int Builtin::num_libs_ = 25 const int Builtin::num_libs_ =
27 sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props); 26 sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props);
28 27
29 28
30 Dart_Handle Builtin::Source(BuiltinLibraryId id) { 29 Dart_Handle Builtin::Source(BuiltinLibraryId id) {
31 return DartUtils::NewError("Unreachable code in Builtin::Source (%d).", id); 30 return DartUtils::NewError("Unreachable code in Builtin::Source (%d).", id);
32 } 31 }
33 32
34 33
35 Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* uri) { 34 Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* uri) {
36 return DartUtils::NewError( 35 return DartUtils::NewError("Unreachable code in Builtin::PartSource (%d).",
37 "Unreachable code in Builtin::PartSource (%d).", id); 36 id);
38 } 37 }
39 38
40 39
41 Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) { 40 Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) {
42 return DartUtils::NewError( 41 return DartUtils::NewError("Unreachable code in Builtin::GetSource (%s).",
43 "Unreachable code in Builtin::GetSource (%s).", uri); 42 uri);
44 } 43 }
45 44
46 45
47 void Builtin::SetNativeResolver(BuiltinLibraryId id) { 46 void Builtin::SetNativeResolver(BuiltinLibraryId id) {
48 ASSERT(static_cast<int>(id) >= 0); 47 ASSERT(static_cast<int>(id) >= 0);
49 ASSERT(static_cast<int>(id) < num_libs_); 48 ASSERT(static_cast<int>(id) < num_libs_);
50 49
51 if (builtin_libraries_[id].has_natives_) { 50 if (builtin_libraries_[id].has_natives_) {
52 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); 51 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
53 Dart_Handle library = Dart_LookupLibrary(url); 52 Dart_Handle library = Dart_LookupLibrary(url);
54 ASSERT(!Dart_IsError(library)); 53 ASSERT(!Dart_IsError(library));
55 // Setup the native resolver for built in library functions. 54 // Setup the native resolver for built in library functions.
56 DART_CHECK_VALID( 55 DART_CHECK_VALID(
57 Dart_SetNativeResolver(library, NativeLookup, NativeSymbol)); 56 Dart_SetNativeResolver(library, NativeLookup, NativeSymbol));
58 } 57 }
59 } 58 }
60 59
61 60
62 Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) { 61 Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) {
63 return DartUtils::NewError( 62 return DartUtils::NewError("Unreachable code in Builtin::LoadLibrary (%d).",
64 "Unreachable code in Builtin::LoadLibrary (%d).", id); 63 id);
65 } 64 }
66 65
67 66
68 Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) { 67 Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) {
69 return kInvalidLibrary; 68 return kInvalidLibrary;
70 } 69 }
71 70
72 71
73 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) { 72 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
74 ASSERT(static_cast<int>(id) >= 0); 73 ASSERT(static_cast<int>(id) >= 0);
75 ASSERT(static_cast<int>(id) < num_libs_); 74 ASSERT(static_cast<int>(id) < num_libs_);
76 75
77 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); 76 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
78 Dart_Handle library = Dart_LookupLibrary(url); 77 Dart_Handle library = Dart_LookupLibrary(url);
79 return library; 78 return library;
80 } 79 }
81 80
82 } // namespace bin 81 } // namespace bin
83 } // namespace dart 82 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/crypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698