zoukankan      html  css  js  c++  java
  • chrome源码之恢复上次打开的标签页的学习

    startup_browser_creator_impl.cc

    ————————》打开任何页面或浏览器的入口函数
    bool StartupBrowserCreatorImpl::ProcessStartupURLs(const std::vector<GURL>& urls_to_open)
    ————————》
    Browser* browser = SessionRestore::RestoreSession(profile_, NULL, restore_behavior, adjusted_urls);
    ————————》session_restore.cc
    Browser* SessionRestore::RestoreSession(Profile* profile,Browser* browser,uint32_t behavior,const std::vector<GURL>& urls_to_open)
    ————————》
      Browser* Restore()
    ————————》
      void OnGotSession(std::vector<std::unique_ptr<sessions::SessionWindow>> windows,SessionID::id_type active_window_id)
    ————————》
      Browser* ProcessSessionWindowsAndNotify(std::vector<std::unique_ptr<sessions::SessionWindow>>* windows,SessionID::id_type active_window_id)
    ————————》
      Browser* ProcessSessionWindows(std::vector<std::unique_ptr<sessions::SessionWindow>>* windows,SessionID::id_type active_window_id,std::vector<RestoredTab>* created_contents)
    ————————》在以下函数中将上次的标签页存储到created_contents中并通过RestoreTab一一保存      
    —》RestoreTabsToBrowser(*(*i), browser, initial_tab_count,selected_tab_index, created_contents);——》WebContents* contents = RestoreTab(tab, i, browser, is_selected_tab);
            
    —》Browser* finished_browser = FinishedTabCreation(true, has_tabbed_browser, created_contents);
    ————————》之后是将上次保存的标签页全部打开
    Browser* FinishedTabCreation(bool succeeded,bool created_tabbed_browser,std::vector<RestoredTab>* contents_created)
    ————————》session_restore_delegate.cc
    SessionRestoreDelegate::RestoreTabs(*contents_created, restore_started_);
    ————————》
    void SessionRestoreDelegate::RestoreTabs(const std::vector<RestoredTab>& tabs,const base::TimeTicks& restore_started)
    ————————》
    void TabLoader::RestoreTabs(const std::vector<RestoredTab>& tabs,const base::TimeTicks& restore_started)


    1.首次正常打开
    Restore——》ProcessSessionWindowsAndNotify(Restore中调用)——》ProcessSessionWindows——》RestoreTabsToBrowser——》RestoreTab——》FinishedTabCreation——》RestoreTabs
    2.非首次正常打开(之前有正常关闭的标签页)
    Restore——》ProcessSessionWindowsAndNotify(Restore中调用)——》ProcessSessionWindows——》RestoreTabsToBrowser——》RestoreTab(n个:n为之前打开的标签页个数)——》FinishedTabCreation——》RestoreTabs
    3.非首次非正常打开(之前有未正常关闭的标签页)
    Restore——》OnGotSession——》ProcessSessionWindowsAndNotify(OnGotSession中调用)——》ProcessSessionWindows——》RestoreTabsToBrowser——》RestoreTab(n个:n为之前打开的标签页个数)——》FinishedTabCreation——》RestoreTabs

  • 相关阅读:
    树莓派安装parrot linux记录
    Arch linux(UEFI+GPT)安装及后续优化教程
    VS部分安全函数用法
    C语言博客作业06--结构体&文件
    C语言博客作业05--指针
    C语言博客作业04--数组
    C语言博客作业03--函数
    C语言博客作业02--循环结构
    DS博客作业08--课程总结
    DS博客作业07--查找
  • 原文地址:https://www.cnblogs.com/yanayana/p/6646929.html
Copyright © 2011-2022 走看看