Start with the render_view_impl.cc.
1. The method Renderviewimpl::initialize is:
WebView ()->setmainframe (Webframe::create (Main_render_frame_.get ()));
2. First look at the parameters inside, that is webframe::create
This code executes: method in file webfraemimpl.cc: webframe::create
3. The method above is executed in the same file: Webframeimpl::create
4. The method above performs the overloaded method of the same file: Webframeimpl::create
5. The above method executes the constructor: Webframeimpl::webframeimpl
Note: The Webframeinit object is created in this constructor.
The Webframeinit class is defined in the file WebFrameImpl.h. This class inherits the Frameinit.
Class Webframeinit:public Webcore::frameinit
The Webframeinit constructor is as follows:
Webframeinit (Webframeimpl*webframeimpl, int64_t Frameid)
: Webcore::frameinit (Frameid)
, M_frameloaderclientimpl (Webframeimpl)
{
Setframeloaderclient (&m_frameloaderclientimpl);
}
In this constructor, the frameinit object is created and the Webframeimpl value is paid to the FrameloaderclienT object.
The Frameinit class is defined in the file Frame.h.
Class frameinit:publicrefcounted<frameinit>
6. Next, let's look at
WebView ()->setmainframe (Webframe::create (Main_render_frame_.get ()));
Look at the method Setmainframe
7. This method is in file webviewimpl.cc method: Webviewimpl::setmainframe
The implementation of this method is as follows:
Voidwebviewimpl::setmainframe (webframe* frame)
{
Towebframeimpl (frame)->initializeasmainframe (page ());
}
8. We'll look at the method initializeasmainframe
The method is in the file WebFrameImpl.cpp,
Webframeimpl::initializeasmainframe
In this method, there are
Setwebcoreframe (Frame::create (m_frameinit));
and M_frame->init ();
These two codes are more critical.
9. We look at Frame::create first (m_frameinit)
This method is frame::create in the file Frame.cpp
Passrefptr<frame>frame::create (passrefptr<frameinit> frameinit)
{
refptr<frame> Frame = Adoptref (Newframe (frameinit));
if (!frame->ownerelement ())
Frame->page ()->setmainframe (frame);
Inspectorinstrumentation::frameattachedtoparent (Frame.get ());
return Frame.release ();
}
The frame object is created,
Note: When you create a Frame object, you also create a Frameloader object.
There is code in its constructor:
, M_loader (This,frameinit->frameloaderclient ())
Also, the frame->page ()->setmainframe method can be executed.
10. Look again at M_frame->init ();
11. The above method is in the file Frame.h, there are methods:
inlinevoid frame::init ()
{
M_loader.init ();
}
12. Look again at M_loader.init ();
M_loader is the Frameloader type. The method executes the FrameLoader.cpp file in the method Frameloader::init ()
13. Here is the code M_client->createdocumentloader
Execute the method in file FrameLoaderClientImpl.cpp:
Frameloaderclientimpl::createdocumentloader
Inside, there is code:
Refptr<webdatasourceimpl>ds = Webdatasourceimpl::create (frame, request, data);
14. The above method in the file WebDataSourceImpl.cpp, webdatasourceimpl::create.
15. The method calls the Webdatasourceimpl constructor.
There are, in this constructor,
Webdatasourceimpl::webdatasourceimpl (frame*frame, const resourcerequest& request, const substitutedata& Data)
: Documentloader (frame, request, data)
The Documentloader object is created.
This is the first time the Documentloader object is created.
16. After that, the Documentloader::finishedloading () method is executed, with the code in the method: Commitifready ()
Executes the Documentloader::commitifready () method of the same file.
17. Re-execution Method Frameloader::commitprovisionalload ()
18. Re-execution method:
Frameloaderclientimpl::transitiontocommittedfornewpage ()
19. Re-execution method:
Webframeimpl::createframeview () Create a first Frameview
20. The above is the creation of the first Documentloader object and the Fraemview object.
21. Then execute the method:
Frameloader::loadwithnavigationaction
Frameloaderclientimpl::createdocumentloader
Webdatasourceimpl::create
Documentloader::D Ocumentloader
Creates a second Documentloader object.
22. Then proceed:
Documentloader::d atareceived ()
Documentloader::commitifready ()
Frameloader::commitprovisionalload ()
Frameloaderclientimpl::transitiontocommittedfornewpage ()
Webframeimpl::createframeview ()
Create a second Frameview.
Frameview is a more critical component, it is transparent, can make the entire chromium transparent display Web page