Support implicit detachment of CEF V8 references when the associated context is released (issue #484).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@883 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-10-29 21:54:57 +00:00
parent 3ac5952636
commit 59fe4fbab3
25 changed files with 522 additions and 43 deletions

View File

@@ -921,20 +921,21 @@ void BrowserWebViewDelegate::didCreateScriptContext(
void BrowserWebViewDelegate::willReleaseScriptContext(
WebFrame* frame, v8::Handle<v8::Context> context, int worldId) {
CefRefPtr<CefClient> client = browser_->GetClient();
if (!client.get())
return;
if (client.get()) {
CefRefPtr<CefV8ContextHandler> handler = client->GetV8ContextHandler();
if (handler.get()) {
v8::HandleScope handle_scope;
v8::Context::Scope scope(context);
CefRefPtr<CefV8ContextHandler> handler = client->GetV8ContextHandler();
if (!handler.get())
return;
CefRefPtr<CefFrame> framePtr(browser_->UIT_GetCefFrame(frame));
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
v8::HandleScope handle_scope;
v8::Context::Scope scope(context);
handler->OnContextReleased(browser_, framePtr, contextPtr);
}
}
CefRefPtr<CefFrame> framePtr(browser_->UIT_GetCefFrame(frame));
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
handler->OnContextReleased(browser_, framePtr, contextPtr);
// Disconnect any handles still associated with the context.
CefV8ReleaseContext(context);
}
void BrowserWebViewDelegate::didReceiveTitle(