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

Side by Side Diff: pdf/instance.cc

Issue 718453003: Initialize V8 in PDFium from external files (plugin process only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix API 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 unified diff | Download patch
« no previous file with comments | « components/pdf/renderer/ppb_pdf_impl.cc ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 "pdf/instance.h" 5 #include "pdf/instance.h"
6 6
7 #include <algorithm> // for min() 7 #include <algorithm> // for min()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 // The engine may try to access this instance during its destruction. 316 // The engine may try to access this instance during its destruction.
317 // Make sure this happens early while the instance is still intact. 317 // Make sure this happens early while the instance is still intact.
318 engine_.reset(); 318 engine_.reset();
319 RemovePerInstanceObject(kPPPPdfInterface, this); 319 RemovePerInstanceObject(kPPPPdfInterface, this);
320 } 320 }
321 321
322 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { 322 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
323 v8::StartupData natives; 323 v8::StartupData natives;
324 v8::StartupData snapshot; 324 v8::StartupData snapshot;
325 pp::PDF::GetV8ExternalSnapshotData(&natives.data, &natives.raw_size, 325 pp::PDF::GetV8ExternalSnapshotData(this, &natives.data, &natives.raw_size,
326 &snapshot.data, &snapshot.raw_size); 326 &snapshot.data, &snapshot.raw_size);
327 if (natives.data) { 327 if (natives.data) {
328 natives.compressed_size = natives.raw_size; 328 natives.compressed_size = natives.raw_size;
329 snapshot.compressed_size = snapshot.raw_size; 329 snapshot.compressed_size = snapshot.raw_size;
330 v8::V8::SetNativesDataBlob(&natives); 330 v8::V8::SetNativesDataBlob(&natives);
331 v8::V8::SetSnapshotDataBlob(&snapshot); 331 v8::V8::SetSnapshotDataBlob(&snapshot);
332 } 332 }
333 333
334 // For now, we hide HiDPI support behind a flag. 334 // For now, we hide HiDPI support behind a flag.
335 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) 335 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI))
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 return instance_->HasScriptableMethod(name, exception); 2783 return instance_->HasScriptableMethod(name, exception);
2784 } 2784 }
2785 2785
2786 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2786 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2787 const std::vector<pp::Var>& args, 2787 const std::vector<pp::Var>& args,
2788 pp::Var* exception) { 2788 pp::Var* exception) {
2789 return instance_->CallScriptableMethod(method, args, exception); 2789 return instance_->CallScriptableMethod(method, args, exception);
2790 } 2790 }
2791 2791
2792 } // namespace chrome_pdf 2792 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « components/pdf/renderer/ppb_pdf_impl.cc ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698