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

Unified Diff: runtime/bin/builtin.cc

Issue 2903693003: Read builtin source files directly only under a flag which is off by default. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.cc
diff --git a/runtime/bin/builtin.cc b/runtime/bin/builtin.cc
index cbc20063738280c799ba3b867b3f8c5f71196feb..73f54fd43c1e7d5cdaa568f4775aad312c16b3d0 100644
--- a/runtime/bin/builtin.cc
+++ b/runtime/bin/builtin.cc
@@ -42,15 +42,21 @@ Dart_Port Builtin::load_port_ = ILLEGAL_PORT;
const int Builtin::num_libs_ =
sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props);
+static const bool use_builtin_source_paths = false;
+
// Patch all the specified patch files in the array 'patch_files' into the
// library specified in 'library'.
static void LoadPatchFiles(Dart_Handle library,
const char* patch_uri,
const char** patch_files) {
for (intptr_t j = 0; patch_files[j] != NULL; j += 3) {
- Dart_Handle patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]);
+ Dart_Handle patch_src = Dart_Null();
+ if (use_builtin_source_paths) {
+ patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]);
+ }
if (!Dart_IsString(patch_src)) {
- // In case reading the file caused an error, use the sources directly.
+ // If use_builtin_source_paths is false or reading the file caused
+ // an error, use the sources linked in the binary.
const char* source = patch_files[j + 2];
patch_src = Dart_NewStringFromUTF8(
reinterpret_cast<const uint8_t*>(source), strlen(source));
@@ -95,9 +101,13 @@ Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) {
for (intptr_t i = 0; source_paths[i] != NULL; i += 3) {
if (!strcmp(uri, source_paths[i])) {
const char* source_path = source_paths[i + 1];
- Dart_Handle src = DartUtils::ReadStringFromFile(source_path);
+ Dart_Handle src = Dart_Null();
+ if (use_builtin_source_paths) {
+ src = DartUtils::ReadStringFromFile(source_path);
+ }
if (!Dart_IsString(src)) {
- // In case reading the file caused an error, use the sources directly.
+ // If use_builtin_source_paths is false or reading the file caused
+ // an error, use the sources linked in the binary.
const char* source = source_paths[i + 2];
src = Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(source),
strlen(source));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698