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

Unified Diff: src/startup-data-util.cc

Issue 1567733004: Add diagnostic message if external blob files cannot be loaded. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « src/snapshot/natives-external.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/startup-data-util.cc
diff --git a/src/startup-data-util.cc b/src/startup-data-util.cc
index 92c4b5b3e9820dc9124380bf9a162c263e824604..4e0ad97a0cf6cc67b02adab929d73199c0852043 100644
--- a/src/startup-data-util.cc
+++ b/src/startup-data-util.cc
@@ -9,6 +9,7 @@
#include "src/base/logging.h"
#include "src/base/platform/platform.h"
+#include "src/utils.h"
namespace v8 {
@@ -44,10 +45,13 @@ void Load(const char* blob_file, v8::StartupData* startup_data,
void (*setter_fn)(v8::StartupData*)) {
ClearStartupData(startup_data);
- if (!blob_file) return;
+ CHECK(blob_file);
FILE* file = fopen(blob_file, "rb");
- if (!file) return;
+ if (!file) {
+ PrintF(stderr, "Failed to open startup resource '%s'.\n", blob_file);
+ return;
+ }
fseek(file, 0, SEEK_END);
startup_data->raw_size = static_cast<int>(ftell(file));
@@ -58,7 +62,11 @@ void Load(const char* blob_file, v8::StartupData* startup_data,
1, startup_data->raw_size, file));
fclose(file);
- if (startup_data->raw_size == read_size) (*setter_fn)(startup_data);
+ if (startup_data->raw_size == read_size) {
+ (*setter_fn)(startup_data);
+ } else {
+ PrintF(stderr, "Corrupted startup resource '%s'.\n", blob_file);
+ }
}
« no previous file with comments | « src/snapshot/natives-external.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698