OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |