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

Side by Side Diff: pdf/instance.cc

Issue 819473002: Load V8 external data prior to initializng PDFium SDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused v8 includes Created 5 years, 11 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 | « no previous file | 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 23 matching lines...) Expand all
34 #include "ppapi/cpp/dev/font_dev.h" 34 #include "ppapi/cpp/dev/font_dev.h"
35 #include "ppapi/cpp/dev/memory_dev.h" 35 #include "ppapi/cpp/dev/memory_dev.h"
36 #include "ppapi/cpp/dev/text_input_dev.h" 36 #include "ppapi/cpp/dev/text_input_dev.h"
37 #include "ppapi/cpp/module.h" 37 #include "ppapi/cpp/module.h"
38 #include "ppapi/cpp/point.h" 38 #include "ppapi/cpp/point.h"
39 #include "ppapi/cpp/private/pdf.h" 39 #include "ppapi/cpp/private/pdf.h"
40 #include "ppapi/cpp/rect.h" 40 #include "ppapi/cpp/rect.h"
41 #include "ppapi/cpp/resource.h" 41 #include "ppapi/cpp/resource.h"
42 #include "ppapi/cpp/url_request_info.h" 42 #include "ppapi/cpp/url_request_info.h"
43 #include "ui/events/keycodes/keyboard_codes.h" 43 #include "ui/events/keycodes/keyboard_codes.h"
44 #include "v8/include/v8.h"
45 44
46 #if defined(OS_MACOSX) 45 #if defined(OS_MACOSX)
47 #include "base/mac/mac_util.h" 46 #include "base/mac/mac_util.h"
48 #endif 47 #endif
49 48
50 namespace chrome_pdf { 49 namespace chrome_pdf {
51 50
52 struct ToolbarButtonInfo { 51 struct ToolbarButtonInfo {
53 uint32 id; 52 uint32 id;
54 Button::ButtonStyle style; 53 Button::ButtonStyle style;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 timer_factory_.CancelAll(); 324 timer_factory_.CancelAll();
326 timer_pending_ = false; 325 timer_pending_ = false;
327 } 326 }
328 // The engine may try to access this instance during its destruction. 327 // The engine may try to access this instance during its destruction.
329 // Make sure this happens early while the instance is still intact. 328 // Make sure this happens early while the instance is still intact.
330 engine_.reset(); 329 engine_.reset();
331 RemovePerInstanceObject(kPPPPdfInterface, this); 330 RemovePerInstanceObject(kPPPPdfInterface, this);
332 } 331 }
333 332
334 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { 333 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
335 v8::StartupData natives;
336 v8::StartupData snapshot;
337 pp::PDF::GetV8ExternalSnapshotData(this, &natives.data, &natives.raw_size,
338 &snapshot.data, &snapshot.raw_size);
339 if (natives.data) {
340 v8::V8::SetNativesDataBlob(&natives);
341 v8::V8::SetSnapshotDataBlob(&snapshot);
342 }
343
344 // For now, we hide HiDPI support behind a flag. 334 // For now, we hide HiDPI support behind a flag.
345 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) 335 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI))
346 hidpi_enabled_ = true; 336 hidpi_enabled_ = true;
347 337
348 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING); 338 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING);
349 if (printing_enabled_) { 339 if (printing_enabled_) {
350 CreateToolbar(kPDFToolbarButtons, arraysize(kPDFToolbarButtons)); 340 CreateToolbar(kPDFToolbarButtons, arraysize(kPDFToolbarButtons));
351 } else { 341 } else {
352 CreateToolbar(kPDFNoPrintToolbarButtons, 342 CreateToolbar(kPDFNoPrintToolbarButtons,
353 arraysize(kPDFNoPrintToolbarButtons)); 343 arraysize(kPDFNoPrintToolbarButtons));
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 return instance_->HasScriptableMethod(name, exception); 2789 return instance_->HasScriptableMethod(name, exception);
2800 } 2790 }
2801 2791
2802 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2792 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2803 const std::vector<pp::Var>& args, 2793 const std::vector<pp::Var>& args,
2804 pp::Var* exception) { 2794 pp::Var* exception) {
2805 return instance_->CallScriptableMethod(method, args, exception); 2795 return instance_->CallScriptableMethod(method, args, exception);
2806 } 2796 }
2807 2797
2808 } // namespace chrome_pdf 2798 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | pdf/out_of_process_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698