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

Unified Diff: pdf/instance.cc

Issue 705623002: Initialize V8 in PDFium from external files (in-renderer process only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Ross and Raymes Created 6 years, 1 month 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
Index: pdf/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index 37192ba7b279f588c90fe8fdddbf04eff22cd9db..42179dbd72e60adcfa50739e78c5c12631d7af4f 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -46,6 +46,10 @@
#include "base/mac/mac_util.h"
#endif
+#ifdef V8_USE_EXTERNAL_STARTUP_DATA
+#include "v8/include/v8.h"
+#endif
+
namespace chrome_pdf {
struct ToolbarButtonInfo {
@@ -319,6 +323,17 @@ Instance::~Instance() {
}
bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
+#ifdef V8_USE_EXTERNAL_STARTUP_DATA
raymes 2014/11/10 03:29:06 It would be better not to use the #ifdef here. Ins
baixo1 2014/11/10 15:59:48 Done.
+ v8::StartupData natives;
+ v8::StartupData snapshot;
+ pp::PDF::GetV8ExternalSnapshotData(this, &natives.data, &natives.raw_size,
+ &snapshot.data, &snapshot.raw_size);
+ natives.compressed_size = natives.raw_size;
+ snapshot.compressed_size = snapshot.raw_size;
+ v8::V8::SetNativesDataBlob(&natives);
+ v8::V8::SetSnapshotDataBlob(&snapshot);
+#endif
+
// For now, we hide HiDPI support behind a flag.
if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI))
hidpi_enabled_ = true;

Powered by Google App Engine
This is Rietveld 408576698