[unseasoned-pdf] Use a runtime flag around V8 initialization
Replaces a build flag.
Meanwhile, remove a stale comment about Cppgc cleanup.
Bug: 1111024
Change-Id: Ib696c0a1b38422817a902990f02d6a0d142bf59e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3022011
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Hui Yingst <nigi@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900667}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e628f716da
commit
6cda03676f
@ -35,7 +35,6 @@
|
||||
#include "gin/public/isolate_holder.h"
|
||||
#include "gin/public/v8_platform.h"
|
||||
#include "pdf/accessibility_structs.h"
|
||||
#include "pdf/buildflags.h"
|
||||
#include "pdf/document_loader_impl.h"
|
||||
#include "pdf/draw_utils/coordinates.h"
|
||||
#include "pdf/draw_utils/shadow.h"
|
||||
@ -248,19 +247,19 @@ bool IsV8Initialized() {
|
||||
}
|
||||
|
||||
void SetUpV8() {
|
||||
#if !BUILDFLAG(ENABLE_PDF_UNSEASONED)
|
||||
// TODO(crbug.com/1111024): V8 flags for the Unseasoned Viewer need to be
|
||||
// set up as soon as the renderer process is created in the constructor of
|
||||
// `content::RenderProcessImpl`.
|
||||
const char* recommended = FPDF_GetRecommendedV8Flags();
|
||||
v8::V8::SetFlagsFromString(recommended, strlen(recommended));
|
||||
if (!base::FeatureList::IsEnabled(features::kPdfUnseasoned)) {
|
||||
// TODO(crbug.com/1111024): V8 flags for the Unseasoned Viewer need to be
|
||||
// set up as soon as the renderer process is created in the constructor of
|
||||
// `content::RenderProcessImpl`.
|
||||
const char* recommended = FPDF_GetRecommendedV8Flags();
|
||||
v8::V8::SetFlagsFromString(recommended, strlen(recommended));
|
||||
|
||||
// The isolate holder is already initialized in the renderer process.
|
||||
gin::IsolateHolder::Initialize(
|
||||
gin::IsolateHolder::kNonStrictMode,
|
||||
static_cast<v8::ArrayBuffer::Allocator*>(
|
||||
FPDF_GetArrayBufferAllocatorSharedInstance()));
|
||||
#endif
|
||||
// The isolate holder is already initialized in the renderer process.
|
||||
gin::IsolateHolder::Initialize(
|
||||
gin::IsolateHolder::kNonStrictMode,
|
||||
static_cast<v8::ArrayBuffer::Allocator*>(
|
||||
FPDF_GetArrayBufferAllocatorSharedInstance()));
|
||||
}
|
||||
|
||||
DCHECK(!g_isolate_holder);
|
||||
g_isolate_holder = new gin::IsolateHolder(
|
||||
@ -273,8 +272,6 @@ void SetUpV8() {
|
||||
}
|
||||
|
||||
void TearDownV8() {
|
||||
// TODO(crbug.com/1056170): How should cppgc be properly shutdown when it is
|
||||
// used in other parts of the renderer process?
|
||||
#if defined(PDF_ENABLE_XFA)
|
||||
gin::MaybeShutdownCppgc();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user