RenderViewImpl ownership

22 views
Skip to first unread message

Justin

unread,
Nov 8, 2012, 5:17:37 PM11/8/12
to chromi...@chromium.org
Looking at the RenderView creation (content/renderer/render_thread_impl.cc), I can't see who owns this pointer:

void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) {
  EnsureWebKitInitialized();
  // When bringing in render_view, also bring in webkit's glue and jsbindings.
  RenderViewImpl::Create(
...)

Create() appears to return a raw pointer, so how does the instance of RenderViewImpl persist? I had a quick look through the Create() method and constructor but can't see any places where the instance is managed.

Thanks,
Justin.

Lei Zhang

unread,
Nov 8, 2012, 5:24:36 PM11/8/12
to jay...@gmail.com, Chromium-dev
I think it's managed by g_view_map in render_view_impl.cc.
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev

John Abd-El-Malek

unread,
Nov 8, 2012, 5:35:38 PM11/8/12
to Lei Zhang, jay...@gmail.com, Chromium-dev
g_view_map just allows lookup from a WebView*.

RenderViewImpl, like RenderWidget, owns itself. When the ViewMsg_Close arrives, it releases its own refcount.

Justin Saunders

unread,
Nov 8, 2012, 6:26:07 PM11/8/12
to John Abd-El-Malek, Lei Zhang, Chromium-dev
Ok, I see the calls in RenderViewImpl::Create()

AddRef();
...
g_view_map.Get().insert(std::make_pair(webview(), this));


I'll assume the close handler just works.

Thanks!
Justin.
Reply all
Reply to author
Forward
0 new messages