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

Side by Side Diff: content/renderer/pepper/pepper_try_catch.h

Issue 596523002: Make PepperTryCatch hold a reference on PepperPluginInstanceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/renderer/pepper/v8_var_converter.h" 10 #include "content/renderer/pepper/v8_var_converter.h"
(...skipping 16 matching lines...) Expand all
27 virtual bool HasException() = 0; 27 virtual bool HasException() = 0;
28 // Gets the plugin context. Virtual so it can be overriden for testing. 28 // Gets the plugin context. Virtual so it can be overriden for testing.
29 virtual v8::Handle<v8::Context> GetContext(); 29 virtual v8::Handle<v8::Context> GetContext();
30 30
31 // Convenience functions for doing conversions to/from V8 values and sets an 31 // Convenience functions for doing conversions to/from V8 values and sets an
32 // exception if there is an error in the conversion. 32 // exception if there is an error in the conversion.
33 v8::Handle<v8::Value> ToV8(PP_Var var); 33 v8::Handle<v8::Value> ToV8(PP_Var var);
34 ppapi::ScopedPPVar FromV8(v8::Handle<v8::Value> v8_value); 34 ppapi::ScopedPPVar FromV8(v8::Handle<v8::Value> v8_value);
35 35
36 protected: 36 protected:
37 PepperPluginInstanceImpl* instance_; 37 // Make sure that |instance_| is alive for the lifetime of PepperTryCatch.
38 // PepperTryCatch is used mostly in Pepper scripting code, where it can be
39 // possible to enter JavaScript synchronously which can cause the plugin to
40 // be deleted.
41 //
42 // Note that PepperTryCatch objects should only ever be on the stack, so this
43 // shouldn't keep the instance around for too long.
bbudge 2014/09/22 19:38:50 Maybe a note on the constructor?
44 scoped_refptr<PepperPluginInstanceImpl> instance_;
38 45
39 // Whether To/FromV8 should convert object vars. If set to 46 // Whether To/FromV8 should convert object vars. If set to
40 // kDisallowObjectVars, an exception should be set if they are encountered 47 // kDisallowObjectVars, an exception should be set if they are encountered
41 // during conversion. 48 // during conversion.
42 V8VarConverter::AllowObjectVars convert_objects_; 49 V8VarConverter::AllowObjectVars convert_objects_;
43 }; 50 };
44 51
45 // Catches var exceptions and emits a v8 exception. 52 // Catches var exceptions and emits a v8 exception.
46 class PepperTryCatchV8 : public PepperTryCatch { 53 class PepperTryCatchV8 : public PepperTryCatch {
47 public: 54 public:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 96
90 PP_Var* exception_; 97 PP_Var* exception_;
91 bool exception_is_set_; 98 bool exception_is_set_;
92 99
93 DISALLOW_COPY_AND_ASSIGN(PepperTryCatchVar); 100 DISALLOW_COPY_AND_ASSIGN(PepperTryCatchVar);
94 }; 101 };
95 102
96 } // namespace content 103 } // namespace content
97 104
98 #endif // CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_ 105 #endif // CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_
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