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

Unified Diff: testing/test_support.cpp

Issue 2068563002: Fix memory leaks with V8 startup data. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix non-V8 builds Created 4 years, 6 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 | « testing/embedder_test.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/test_support.cpp
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 96a18a547a10aa0e4dbd47220fe0523624133c72..c4d915e900422e150776bb9254af85f57e54eb6b 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -157,12 +157,14 @@ bool InitializeV8ForPDFium(const std::string& exe_path,
v8::StartupData* snapshot_blob,
v8::Platform** platform) {
InitializeV8Common(exe_path.c_str(), platform);
- if (!GetExternalData(exe_path, bin_dir, "natives_blob.bin", natives_blob))
- return false;
- if (!GetExternalData(exe_path, bin_dir, "snapshot_blob.bin", snapshot_blob))
- return false;
- v8::V8::SetNativesDataBlob(natives_blob);
- v8::V8::SetSnapshotDataBlob(snapshot_blob);
+ if (natives_blob && snapshot_blob) {
+ if (!GetExternalData(exe_path, bin_dir, "natives_blob.bin", natives_blob))
+ return false;
+ if (!GetExternalData(exe_path, bin_dir, "snapshot_blob.bin", snapshot_blob))
+ return false;
+ v8::V8::SetNativesDataBlob(natives_blob);
+ v8::V8::SetSnapshotDataBlob(snapshot_blob);
+ }
return true;
}
#else // V8_USE_EXTERNAL_STARTUP_DATA
« no previous file with comments | « testing/embedder_test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698