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

Side by Side Diff: testing/embedder_test.cpp

Issue 2068563002: Fix memory leaks with V8 startup data. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/embedder_test.h" 5 #include "testing/embedder_test.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #else 55 #else
56 InitializeV8ForPDFium(g_exe_path_, &platform_); 56 InitializeV8ForPDFium(g_exe_path_, &platform_);
57 #endif // V8_USE_EXTERNAL_STARTUP_DATA 57 #endif // V8_USE_EXTERNAL_STARTUP_DATA
58 #endif // FPDF_ENABLE_V8 58 #endif // FPDF_ENABLE_V8
59 } 59 }
60 60
61 EmbedderTest::~EmbedderTest() { 61 EmbedderTest::~EmbedderTest() {
62 #ifdef PDF_ENABLE_V8 62 #ifdef PDF_ENABLE_V8
63 v8::V8::ShutdownPlatform(); 63 v8::V8::ShutdownPlatform();
64 delete platform_; 64 delete platform_;
65
66 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
67 free(const_cast<char*>(natives_.data));
Lei Zhang 2016/06/20 18:57:07 Not sure why I didn't notice the bot failure earli
68 free(const_cast<char*>(snapshot_.data));
69 #endif // V8_USE_EXTERNAL_STARTUP_DATA
65 #endif // PDF_ENABLE_V8 70 #endif // PDF_ENABLE_V8
66 } 71 }
67 72
68 void EmbedderTest::SetUp() { 73 void EmbedderTest::SetUp() {
69 FPDF_LIBRARY_CONFIG config; 74 FPDF_LIBRARY_CONFIG config;
70 config.version = 2; 75 config.version = 2;
71 config.m_pUserFontPaths = nullptr; 76 config.m_pUserFontPaths = nullptr;
72 config.m_v8EmbedderSlot = 0; 77 config.m_v8EmbedderSlot = 0;
73 config.m_pIsolate = external_isolate_; 78 config.m_pIsolate = external_isolate_;
74 FPDF_InitLibraryWithConfig(&config); 79 FPDF_InitLibraryWithConfig(&config);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 322 }
318 323
319 // Can't use gtest-provided main since we need to stash the path to the 324 // Can't use gtest-provided main since we need to stash the path to the
320 // executable in order to find the external V8 binary data files. 325 // executable in order to find the external V8 binary data files.
321 int main(int argc, char** argv) { 326 int main(int argc, char** argv) {
322 g_exe_path_ = argv[0]; 327 g_exe_path_ = argv[0];
323 testing::InitGoogleTest(&argc, argv); 328 testing::InitGoogleTest(&argc, argv);
324 testing::InitGoogleMock(&argc, argv); 329 testing::InitGoogleMock(&argc, argv);
325 return RUN_ALL_TESTS(); 330 return RUN_ALL_TESTS();
326 } 331 }
OLDNEW
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698