summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/chrome_v8_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/extensions/chrome_v8_context.h')
-rw-r--r--chrome/renderer/extensions/chrome_v8_context.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/chrome/renderer/extensions/chrome_v8_context.h b/chrome/renderer/extensions/chrome_v8_context.h
index 8c71c04..d541e2c 100644
--- a/chrome/renderer/extensions/chrome_v8_context.h
+++ b/chrome/renderer/extensions/chrome_v8_context.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "chrome/common/extensions/features/feature.h"
#include "chrome/renderer/extensions/module_system.h"
+#include "chrome/renderer/extensions/scoped_persistent.h"
#include "v8/include/v8.h"
namespace WebKit {
@@ -37,7 +38,7 @@ class ChromeV8Context {
~ChromeV8Context();
v8::Handle<v8::Context> v8_context() const {
- return v8_context_;
+ return v8_context_.get();
}
const Extension* extension() const {
@@ -104,14 +105,8 @@ class ChromeV8Context {
std::string GetContextTypeDescription();
private:
- // The v8 context the bindings are accessible to. We keep a strong reference
- // to it for simplicity. In the case of content scripts, this is necessary
- // because we want all scripts from the same extension for the same frame to
- // run in the same context, so we can't have the contexts being GC'd if
- // nothing is happening. In the case of page contexts, this isn't necessary
- // since the DOM keeps the context alive, but it makes things simpler to not
- // distinguish the two cases.
- v8::Persistent<v8::Context> v8_context_;
+ // The v8 context the bindings are accessible to.
+ ScopedPersistent<v8::Context> v8_context_;
// The WebFrame associated with this context. This can be NULL because this
// object can outlive is destroyed asynchronously.