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

Side by Side Diff: mojo/dart/embedder/builtin.h

Issue 950063002: Add patch file support to Dart embedder (Closed) Base URL: https://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 | « mojo/dart/embedder/BUILD.gn ('k') | mojo/dart/embedder/builtin.cc » ('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 #ifndef MOJO_DART_EMBEDDER_BUILTIN_H_ 5 #ifndef MOJO_DART_EMBEDDER_BUILTIN_H_
6 #define MOJO_DART_EMBEDDER_BUILTIN_H_ 6 #define MOJO_DART_EMBEDDER_BUILTIN_H_
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 15 matching lines...) Expand all
26 // the builtin_libraries_ array in builtin.cc. 26 // the builtin_libraries_ array in builtin.cc.
27 enum BuiltinLibraryId { 27 enum BuiltinLibraryId {
28 kBuiltinLibrary = 0, 28 kBuiltinLibrary = 0,
29 kMojoBindingsLibrary = 1, 29 kMojoBindingsLibrary = 1,
30 kMojoCoreLibrary = 2, 30 kMojoCoreLibrary = 2,
31 kInvalidLibrary, 31 kInvalidLibrary,
32 }; 32 };
33 33
34 static uint8_t snapshot_magic_number[4]; 34 static uint8_t snapshot_magic_number[4];
35 35
36 static void SetNativeResolver(BuiltinLibraryId id); 36 // Return the library specified in 'id'.
37 static Dart_Handle GetLibrary(BuiltinLibraryId id);
37 38
38 // Check if built in library specified in 'id' is already loaded, if not 39 // Prepare the library specified in 'id'. Preparation includes:
39 // load it. 40 // 1) Setting the native resolver (if any).
40 static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id); 41 // 2) Applying patch files (if any).
42 // NOTE: This should only be called once for a library per isolate.
43 static void PrepareLibrary(BuiltinLibraryId id);
41 44
42 static int64_t GetIntegerValue(Dart_Handle value_obj) { 45 static int64_t GetIntegerValue(Dart_Handle value_obj) {
43 int64_t value = 0; 46 int64_t value = 0;
44 Dart_Handle result = Dart_IntegerToInt64(value_obj, &value); 47 Dart_Handle result = Dart_IntegerToInt64(value_obj, &value);
45 if (Dart_IsError(result)) 48 if (Dart_IsError(result))
46 Dart_PropagateError(result); 49 Dart_PropagateError(result);
47 return value; 50 return value;
48 } 51 }
49 52
50 static Dart_Handle NewError(const char* format, ...); 53 static Dart_Handle NewError(const char* format, ...);
51 54
52 private: 55 private:
53 // Native method support. 56 // Native method support.
54 static Dart_NativeFunction NativeLookup(Dart_Handle name, 57 static Dart_NativeFunction NativeLookup(Dart_Handle name,
55 int argument_count, 58 int argument_count,
56 bool* auto_setup_scope); 59 bool* auto_setup_scope);
57 60
58 static const uint8_t* NativeSymbol(Dart_NativeFunction nf); 61 static const uint8_t* NativeSymbol(Dart_NativeFunction nf);
59 62 static Dart_Handle GetStringResource(const char* resource_name);
63 static void LoadPatchFiles(Dart_Handle library,
64 const char* patch_uri,
65 const char** patch_files);
60 typedef struct { 66 typedef struct {
61 const char* url_; 67 const char* url_;
62 bool has_natives_; 68 bool has_natives_;
63 Dart_NativeEntrySymbol native_symbol_; 69 Dart_NativeEntrySymbol native_symbol_;
64 Dart_NativeEntryResolver native_resolver_; 70 Dart_NativeEntryResolver native_resolver_;
71 const char* patch_url_;
72 const char** patch_resources_;
65 } builtin_lib_props; 73 } builtin_lib_props;
66 static builtin_lib_props builtin_libraries_[]; 74 static builtin_lib_props builtin_libraries_[];
67 75
76 static const char* mojo_core_patch_resource_names_[];
68 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); 77 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin);
69 }; 78 };
70 79
71 } // namespace dart 80 } // namespace dart
72 } // namespace mojo 81 } // namespace mojo
73 82
74 #endif // MOJO_DART_EMBEDDER_BUILTIN_H_ 83 #endif // MOJO_DART_EMBEDDER_BUILTIN_H_
OLDNEW
« no previous file with comments | « mojo/dart/embedder/BUILD.gn ('k') | mojo/dart/embedder/builtin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698