From b0fb8cc23c0ae555726f873101961676f96f6f07 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 8 Feb 2018 14:01:32 +0000 Subject: [v8-platform] Store the platform in a unique_ptr. (Try 2) We want to change the signature of {CreateDefaultPlatform} in the V8 API to return a unique_ptr instead of a raw pointer to indicate that the caller owns the platform. With this change we prepare pdfium for this change. In this second attempt, keep the old InitializeV8ForPDFium() method around to complete the Chromium DEPS roll. Once that lands safely, remove it from PDFium. This relands commit 608e8dd6 and commit 3355f459, which commit b3a3eaab reverts. Change-Id: Icc60b17ca202637d34ae242c0785d939194d0fe6 Reviewed-on: https://pdfium-review.googlesource.com/25950 Commit-Queue: dsinclair Reviewed-by: dsinclair --- samples/pdfium_test.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index b83663db69..ebc7412055 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -1567,14 +1567,14 @@ int main(int argc, const char* argv[]) { } #ifdef PDF_ENABLE_V8 - v8::Platform* platform; + std::unique_ptr platform; #ifdef V8_USE_EXTERNAL_STARTUP_DATA v8::StartupData natives; v8::StartupData snapshot; - InitializeV8ForPDFium(options.exe_path, options.bin_directory, &natives, - &snapshot, &platform); + platform = InitializeV8ForPDFiumWithStartupData( + options.exe_path, options.bin_directory, &natives, &snapshot); #else // V8_USE_EXTERNAL_STARTUP_DATA - InitializeV8ForPDFium(options.exe_path, &platform); + platform = InitializeV8ForPDFium(options.exe_path); #endif // V8_USE_EXTERNAL_STARTUP_DATA #endif // PDF_ENABLE_V8 @@ -1641,7 +1641,6 @@ int main(int argc, const char* argv[]) { FPDF_DestroyLibrary(); #ifdef PDF_ENABLE_V8 v8::V8::ShutdownPlatform(); - delete platform; #ifdef V8_USE_EXTERNAL_STARTUP_DATA free(const_cast(natives.data)); -- cgit v1.2.3