diff options
author | Andreas Haas <ahaas@chromium.org> | 2018-02-05 18:32:18 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-05 18:32:18 +0000 |
commit | 608e8dd6b87b15772862dca9b7b2e6791a25dab6 (patch) | |
tree | 384dbec190cf8a7901af8dd1cdb37aafac10766a /testing/embedder_test_main.cpp | |
parent | a21d593e202cbef9a0641d0123917ac3b8d73ee6 (diff) | |
download | pdfium-608e8dd6b87b15772862dca9b7b2e6791a25dab6.tar.xz |
[v8-platform] Store the platform in a unique_ptr
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.
R=thestig@chromium.org
Change-Id: I4a0a466dfc37b28387a91543623a7a481ca8035a
Reviewed-on: https://pdfium-review.googlesource.com/18191
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'testing/embedder_test_main.cpp')
-rw-r--r-- | testing/embedder_test_main.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/testing/embedder_test_main.cpp b/testing/embedder_test_main.cpp index ade6118e64..03c192b08a 100644 --- a/testing/embedder_test_main.cpp +++ b/testing/embedder_test_main.cpp @@ -34,16 +34,16 @@ class Environment : public testing::Environment { #ifdef PDF_ENABLE_V8 #ifdef V8_USE_EXTERNAL_STARTUP_DATA if (g_v8_natives && g_v8_snapshot) { - InitializeV8ForPDFium(g_exe_path, std::string(), nullptr, nullptr, - &platform_); + platform_ = + InitializeV8ForPDFium(g_exe_path, std::string(), nullptr, nullptr); } else { g_v8_natives = new v8::StartupData; g_v8_snapshot = new v8::StartupData; - InitializeV8ForPDFium(g_exe_path, std::string(), g_v8_natives, - g_v8_snapshot, &platform_); + platform_ = InitializeV8ForPDFium(g_exe_path, std::string(), g_v8_natives, + g_v8_snapshot); } #else - InitializeV8ForPDFium(g_exe_path, &platform_); + platform_ = InitializeV8ForPDFium(g_exe_path); #endif // V8_USE_EXTERNAL_STARTUP_DATA #endif // FPDF_ENABLE_V8 } @@ -51,13 +51,12 @@ class Environment : public testing::Environment { void TearDown() override { #ifdef PDF_ENABLE_V8 v8::V8::ShutdownPlatform(); - delete platform_; #endif // PDF_ENABLE_V8 } private: #ifdef PDF_ENABLE_V8 - v8::Platform* platform_; + std::unique_ptr<v8::Platform> platform_; #endif // PDF_ENABLE_V8 }; |