Support implicit detachment of CEF V8 references when the associated context is released (issue #484).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@882 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
0cea9668fe
commit
3ac5952636
|
@ -211,31 +211,27 @@ void CefContentRendererClient::WillReleaseScriptContext(
|
||||||
WebKit::WebFrame* frame, v8::Handle<v8::Context> context, int world_id) {
|
WebKit::WebFrame* frame, v8::Handle<v8::Context> context, int world_id) {
|
||||||
// Notify the render process handler.
|
// Notify the render process handler.
|
||||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||||
if (!application.get())
|
if (application.get()) {
|
||||||
return;
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
|
application->GetRenderProcessHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||||
|
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
|
||||||
|
DCHECK(browserPtr.get());
|
||||||
|
if (browserPtr.get()) {
|
||||||
|
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||||
|
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
v8::HandleScope handle_scope;
|
||||||
application->GetRenderProcessHandler();
|
v8::Context::Scope scope(context);
|
||||||
if (!handler.get())
|
WebCore::V8RecursionScope recursion_scope(
|
||||||
return;
|
WebCore::getScriptExecutionContext());
|
||||||
|
|
||||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
|
||||||
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
|
|
||||||
DCHECK(browserPtr.get());
|
|
||||||
if (!browserPtr.get())
|
|
||||||
return;
|
|
||||||
|
|
||||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
handler->OnContextReleased(browserPtr.get(), framePtr.get(),
|
||||||
|
contextPtr);
|
||||||
{
|
}
|
||||||
v8::HandleScope handle_scope;
|
}
|
||||||
v8::Context::Scope scope(context);
|
|
||||||
WebCore::V8RecursionScope recursion_scope(
|
|
||||||
WebCore::getScriptExecutionContext());
|
|
||||||
|
|
||||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
|
|
||||||
|
|
||||||
handler->OnContextReleased(browserPtr.get(), framePtr.get(), contextPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefV8ReleaseContext(context);
|
CefV8ReleaseContext(context);
|
||||||
|
|
Loading…
Reference in New Issue