summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/chrome_v8_context.cc
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-09 02:51:52 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-09 02:51:52 +0000
commitdaeb3387371081e25680ff73d6efcdcf9243ce91 (patch)
tree6ad3bc8c53ba6434bc9251a58e82251cd4316f6e /chrome/renderer/extensions/chrome_v8_context.cc
parent801978d367a3a5ef6cea09df395bf6b8cb2a9845 (diff)
downloadchromium_src-daeb3387371081e25680ff73d6efcdcf9243ce91.zip
chromium_src-daeb3387371081e25680ff73d6efcdcf9243ce91.tar.gz
chromium_src-daeb3387371081e25680ff73d6efcdcf9243ce91.tar.bz2
Add a ScopedPersistent class to chrome/renderer/extensions for automatically
New'ing and Dispose'ing v8::Persistent handles. TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/12705003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/chrome_v8_context.cc')
-rw-r--r--chrome/renderer/extensions/chrome_v8_context.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/chrome/renderer/extensions/chrome_v8_context.cc b/chrome/renderer/extensions/chrome_v8_context.cc
index 2abc772..b683507 100644
--- a/chrome/renderer/extensions/chrome_v8_context.cc
+++ b/chrome/renderer/extensions/chrome_v8_context.cc
@@ -33,8 +33,7 @@ ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context,
WebKit::WebFrame* web_frame,
const Extension* extension,
Feature::Context context_type)
- : v8_context_(v8::Persistent<v8::Context>::New(v8_context->GetIsolate(),
- v8_context)),
+ : v8_context_(v8_context),
web_frame_(web_frame),
extension_(extension),
context_type_(context_type) {
@@ -47,7 +46,6 @@ ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context,
ChromeV8Context::~ChromeV8Context() {
VLOG(1) << "Destroyed context for extension\n"
<< " extension id: " << GetExtensionID();
- v8_context_.Dispose(v8_context_->GetIsolate());
}
std::string ChromeV8Context::GetExtensionID() {
@@ -97,7 +95,7 @@ bool ChromeV8Context::CallChromeHiddenMethod(
int argc,
v8::Handle<v8::Value>* argv,
v8::Handle<v8::Value>* result) const {
- v8::Context::Scope context_scope(v8_context_);
+ v8::Context::Scope context_scope(v8_context_.get());
// ChromeV8ContextSet calls clear_web_frame() and then schedules a task to
// delete this object. This check prevents a race from attempting to execute