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

Side by Side Diff: pdf/instance.cc

Issue 300403002: Reset scoped_ptr to make plugin crash on higher level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 AddPerInstanceObject(kPPPPdfInterface, this); 301 AddPerInstanceObject(kPPPPdfInterface, this);
302 302
303 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); 303 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
304 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_WHEEL); 304 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_WHEEL);
305 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); 305 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
306 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH); 306 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH);
307 } 307 }
308 308
309 Instance::~Instance() { 309 Instance::~Instance() {
310 RemovePerInstanceObject(kPPPPdfInterface, this); 310 RemovePerInstanceObject(kPPPPdfInterface, this);
311 // TODO(vitalybuka): remove after crbug.com/372095 fixed.
312 // Reset to NULL to make it crash in HandleDocumentLoad if called for
313 // deleted instance. scoped_ptr::~scoped_ptr does not reset pointer to NULL.
314 engine_.reset();
311 } 315 }
312 316
313 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { 317 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
314 // For now, we hide HiDPI support behind a flag. 318 // For now, we hide HiDPI support behind a flag.
315 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) 319 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI))
316 hidpi_enabled_ = true; 320 hidpi_enabled_ = true;
317 321
318 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING); 322 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING);
319 if (printing_enabled_) { 323 if (printing_enabled_) {
320 CreateToolbar(kPDFToolbarButtons, arraysize(kPDFToolbarButtons)); 324 CreateToolbar(kPDFToolbarButtons, arraysize(kPDFToolbarButtons));
(...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 return instance_->HasScriptableMethod(name, exception); 2714 return instance_->HasScriptableMethod(name, exception);
2711 } 2715 }
2712 2716
2713 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2717 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2714 const std::vector<pp::Var>& args, 2718 const std::vector<pp::Var>& args,
2715 pp::Var* exception) { 2719 pp::Var* exception) {
2716 return instance_->CallScriptableMethod(method, args, exception); 2720 return instance_->CallScriptableMethod(method, args, exception);
2717 } 2721 }
2718 2722
2719 } // namespace chrome_pdf 2723 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698