diff options
author | dmichael <dmichael@chromium.org> | 2014-09-22 14:10:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-22 21:10:26 +0000 |
commit | 4c929f39322d01f407c5469a84ed5109f379ebe6 (patch) | |
tree | 2f4d35a859a9c085e4483e391ee2ea1656f9c0ed /content | |
parent | fcb5f75316cf0b5e17830344bb58319a277f73b6 (diff) | |
download | chromium_src-4c929f39322d01f407c5469a84ed5109f379ebe6.zip chromium_src-4c929f39322d01f407c5469a84ed5109f379ebe6.tar.gz chromium_src-4c929f39322d01f407c5469a84ed5109f379ebe6.tar.bz2 |
Make PepperTryCatch hold a reference on PepperPluginInstanceImpl
BUG=416311
Review URL: https://codereview.chromium.org/596523002
Cr-Commit-Position: refs/heads/master@{#296055}
Diffstat (limited to 'content')
-rw-r--r-- | content/renderer/pepper/pepper_try_catch.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/content/renderer/pepper/pepper_try_catch.h b/content/renderer/pepper/pepper_try_catch.h index dba90aa..819d269 100644 --- a/content/renderer/pepper/pepper_try_catch.h +++ b/content/renderer/pepper/pepper_try_catch.h @@ -19,6 +19,8 @@ class PepperPluginInstanceImpl; // Base class for scripting TryCatch helpers. class CONTENT_EXPORT PepperTryCatch { public: + // PepperTryCatch objects should only be used as stack variables. This object + // takes a reference on the given PepperPluginInstanceImpl. PepperTryCatch(PepperPluginInstanceImpl* instance, V8VarConverter::AllowObjectVars convert_objects); virtual ~PepperTryCatch(); @@ -34,7 +36,14 @@ class CONTENT_EXPORT PepperTryCatch { ppapi::ScopedPPVar FromV8(v8::Handle<v8::Value> v8_value); protected: - PepperPluginInstanceImpl* instance_; + // Make sure that |instance_| is alive for the lifetime of PepperTryCatch. + // PepperTryCatch is used mostly in Pepper scripting code, where it can be + // possible to enter JavaScript synchronously which can cause the plugin to + // be deleted. + // + // Note that PepperTryCatch objects should only ever be on the stack, so this + // shouldn't keep the instance around for too long. + scoped_refptr<PepperPluginInstanceImpl> instance_; // Whether To/FromV8 should convert object vars. If set to // kDisallowObjectVars, an exception should be set if they are encountered |