Changeset 83895 in webkit


Ignore:
Timestamp:
Apr 14, 2011 2:39:08 PM (13 years ago)
Author:
weinig@apple.com
Message:

Make creating WebPreferences lazy
https://bugs.webkit.org/show_bug.cgi?id=58570

Reviewed by Anders Carlsson.

  • UIProcess/WebPageGroup.cpp:

(WebKit::WebPageGroup::WebPageGroup):
(WebKit::WebPageGroup::~WebPageGroup):
(WebKit::WebPageGroup::setPreferences):
(WebKit::WebPageGroup::preferences):

  • UIProcess/WebPageGroup.h:

Don't create the WebPreference object until it is requested.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r83882 r83895  
     12011-04-14  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Make creating WebPreferences lazy
     6        https://bugs.webkit.org/show_bug.cgi?id=58570
     7
     8        * UIProcess/WebPageGroup.cpp:
     9        (WebKit::WebPageGroup::WebPageGroup):
     10        (WebKit::WebPageGroup::~WebPageGroup):
     11        (WebKit::WebPageGroup::setPreferences):
     12        (WebKit::WebPageGroup::preferences):
     13        * UIProcess/WebPageGroup.h:
     14        Don't create the WebPreference object until it is requested.
     15
    1162011-04-14  Pratik Solanki  <psolanki@apple.com>
    217
  • trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp

    r83867 r83895  
    6666    m_data.pageGroupID = generatePageGroupID();
    6767
    68     if (!identifier.isNull()) {
     68    if (!identifier.isNull())
    6969        m_data.identifer = identifier;
    70         m_preferences = WebPreferences::create(identifier);
    71     } else {
     70    else
    7271        m_data.identifer = m_data.identifer = makeString("__uniquePageGroupID-", String::number(m_data.pageGroupID));
    73         m_preferences = WebPreferences::create();
    74     }
    75     m_preferences->addPageGroup(this);
    7672
    7773    m_data.visibleToInjectedBundle = visibleToInjectedBundle;
     
    8177WebPageGroup::~WebPageGroup()
    8278{
    83     m_preferences->removePageGroup(this);
     79    if (m_preferences)
     80        m_preferences->removePageGroup(this);
    8481    webPageGroupMap().remove(pageGroupID());
    8582}
     
    10097        return;
    10198
    102     m_preferences->removePageGroup(this);
    103     m_preferences = preferences;
    104     m_preferences->addPageGroup(this);
     99    if (!m_preferences) {
     100        m_preferences = preferences;
     101        m_preferences->addPageGroup(this);
     102    } else {
     103        m_preferences->removePageGroup(this);
     104        m_preferences = preferences;
     105        m_preferences->addPageGroup(this);
    105106
    106     preferencesDidChange();
     107        preferencesDidChange();
     108    }
    107109}
    108110
    109111WebPreferences* WebPageGroup::preferences() const
    110112{
     113    if (!m_preferences) {
     114        if (!m_data.identifer.isNull())
     115            m_preferences = WebPreferences::create(m_data.identifer);
     116        else
     117            m_preferences = WebPreferences::create();
     118        m_preferences->addPageGroup(const_cast<WebPageGroup*>(this));
     119    }
    111120    return m_preferences.get();
    112121}
  • trunk/Source/WebKit2/UIProcess/WebPageGroup.h

    r83867 r83895  
    6464
    6565    WebPageGroupData m_data;
    66     RefPtr<WebPreferences> m_preferences;
     66    mutable RefPtr<WebPreferences> m_preferences;
    6767    HashSet<WebPageProxy*> m_pages;
    6868};
Note: See TracChangeset for help on using the changeset viewer.