Changeset 116712 in webkit


Ignore:
Timestamp:
May 10, 2012 5:42:34 PM (12 years ago)
Author:
Michael Nordman
Message:

Source/WebCore: [chromium] DomStorage events handling needs TLC (2)
https://bugs.webkit.org/show_bug.cgi?id=85221
Alter the StorageArea virtual interface such that the mutators no longer
return old values. This is to allow implementations of the interface to operate
more asynchronously.

Reviewed by Adam Barth.

No new tests. Existing tests cover this.

  • storage/StorageArea.h: Alter the interface so the mutators no longer return previous values
  • storage/StorageAreaImpl.cpp:

(WebCore::StorageAreaImpl::disabledByPrivateBrowsingInFrame): removed an unneeded PLATFORM(CHROMIUM) guard
(WebCore::StorageAreaImpl::setItem): no longer return the old value
(WebCore::StorageAreaImpl::removeItem): no longer return the old value
(WebCore::StorageAreaImpl::clear): no longer return whether something was cleared

  • storage/StorageAreaImpl.h: match StorageArea's virtual interface

Source/WebKit/chromium: [chromium] DomStorage events handling needs TLC (2)
https://bugs.webkit.org/show_bug.cgi?id=85221
Alter the WebStorageArea virtual interface such that the mutators no longer
return old values. This is to allow implementations of the interface to operate
more asynchronously.

Also clean up from the last patch, remove support for the DEPRECATED event
dispatching API.

Reviewed by Adam Barth.

  • WebKit.gyp: delete three files indicated below
  • public/WebStorageArea.h:

(WebKit::WebStorageArea::setItem): no longer returns the old value
(WebKit::WebStorageArea::removeItem): no longer returns the old value
(WebKit::WebStorageArea::clear): no longer returns a bool indicated if something was cleared

  • public/WebStorageEventDispatcher.h: removed the DEPRECATED instance methods
  • public/WebStorageNamespace.h: removed the DEPRECATED close() method
  • public/platform/WebKitPlatformSupport.h: removed the DEPRECATED dispatchStorageEvent() method
  • src/StorageAreaProxy.cpp: removed the DEPREACTED storageEvent() method

(WebCore::StorageAreaProxy::setItem): no return value
(WebCore::StorageAreaProxy::removeItem): no return value
(WebCore::StorageAreaProxy::clear): no return value
(WebCore::StorageAreaProxy::dispatchLocalStorageEvent): remove an early return thats no longer needed
(WebCore::findPageWithSessionStorageNamespace): switched to passing pageGroup by ptr value instead of by name
(WebCore::StorageAreaProxy::dispatchSessionStorageEvent): remove an early return thats no longer needed

  • src/StorageAreaProxy.h:

(WebCore):
(StorageAreaProxy):

  • src/StorageEventDispatcherImpl.cpp: Deleted the file.
  • src/StorageEventDispatcherImpl.h: Deleted the file.
  • src/WebStorageEventDispatcherImpl.cpp: Deleted the DEPRECATED instance methods.

(WebKit::WebStorageEventDispatcher::dispatchLocalStorageEvent): use WebViewImpl::defaultPageGroup
(WebKit::WebStorageEventDispatcher::dispatchSessionStorageEvent): use WebViewImpl::defaultPageGroup

  • src/WebStorageEventDispatcherImpl.h: Deleted the file.
  • src/WebViewImpl.cpp: added a static method to retrieve a ptr to the default page group,

(WebKit::WebViewImpl::defaultPageGroup):

  • src/WebViewImpl.h:
Location:
trunk/Source
Files:
3 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116711 r116712  
     12012-05-10  Michael Nordman  <michaeln@google.com>
     2
     3        [chromium] DomStorage events handling needs TLC (2)
     4        https://bugs.webkit.org/show_bug.cgi?id=85221
     5        Alter the StorageArea virtual interface such that the mutators no longer
     6        return old values. This is to allow implementations of the interface to operate
     7        more asynchronously.
     8
     9        Reviewed by Adam Barth.
     10
     11        No new tests. Existing tests cover this.
     12
     13        * storage/StorageArea.h: Alter the interface so the mutators no longer return previous values
     14        * storage/StorageAreaImpl.cpp:
     15        (WebCore::StorageAreaImpl::disabledByPrivateBrowsingInFrame):  removed an unneeded PLATFORM(CHROMIUM) guard
     16        (WebCore::StorageAreaImpl::setItem): no longer return the old value
     17        (WebCore::StorageAreaImpl::removeItem): no longer return the old value
     18        (WebCore::StorageAreaImpl::clear): no longer return whether something was cleared
     19        * storage/StorageAreaImpl.h: match StorageArea's virtual interface
     20
    1212012-05-10  Beth Dakin  <bdakin@apple.com>
    222
  • trunk/Source/WebCore/storage/StorageArea.h

    r99439 r116712  
    5050        virtual String key(unsigned index, Frame* sourceFrame) const = 0;
    5151        virtual String getItem(const String& key, Frame* sourceFrame) const = 0;
    52         virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) = 0;
    53         virtual String removeItem(const String& key, Frame* sourceFrame) = 0;
    54         virtual bool clear(Frame* sourceFrame) = 0;
     52        virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) = 0;
     53        virtual void removeItem(const String& key, Frame* sourceFrame) = 0;
     54        virtual void clear(Frame* sourceFrame) = 0;
    5555        virtual bool contains(const String& key, Frame* sourceFrame) const = 0;
    5656
  • trunk/Source/WebCore/storage/StorageAreaImpl.cpp

    r104257 r116712  
    103103bool StorageAreaImpl::disabledByPrivateBrowsingInFrame(const Frame* frame) const
    104104{
    105 #if PLATFORM(CHROMIUM)
    106     // The frame pointer can be NULL in Chromium since this call is made in a different
    107     // process from where the Frame object exists.  Luckily, private browseing is
    108     // implemented differently in Chromium, so it'd never return true anyway.
    109     ASSERT(!frame);
    110     return false;
    111 #else
    112105    if (!frame->page())
    113106        return true;
     
    117110        return true;
    118111    return !SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(frame->document()->securityOrigin()->protocol());
    119 #endif
    120112}
    121113
     
    144136}
    145137
    146 String StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
     138void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
    147139{
    148140    ASSERT(!m_isShutdown);
     
    152144    if (disabledByPrivateBrowsingInFrame(frame)) {
    153145        ec = QUOTA_EXCEEDED_ERR;
    154         return String();
     146        return;
    155147    }
    156148
     
    163155    if (quotaException) {
    164156        ec = QUOTA_EXCEEDED_ERR;
    165         return oldValue;
     157        return;
    166158    }
    167159
    168160    if (oldValue == value)
    169         return oldValue;
     161        return;
    170162
    171163    if (m_storageAreaSync)
    172164        m_storageAreaSync->scheduleItemForSync(key, value);
    173165    StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
    174     return oldValue;
    175 }
    176 
    177 String StorageAreaImpl::removeItem(const String& key, Frame* frame)
     166}
     167
     168void StorageAreaImpl::removeItem(const String& key, Frame* frame)
    178169{
    179170    ASSERT(!m_isShutdown);
     
    181172
    182173    if (disabledByPrivateBrowsingInFrame(frame))
    183         return String();
     174        return;
    184175
    185176    String oldValue;
     
    189180
    190181    if (oldValue.isNull())
    191         return oldValue;
     182        return;
    192183
    193184    if (m_storageAreaSync)
    194185        m_storageAreaSync->scheduleItemForSync(key, String());
    195186    StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
    196     return oldValue;
    197 }
    198 
    199 bool StorageAreaImpl::clear(Frame* frame)
     187}
     188
     189void StorageAreaImpl::clear(Frame* frame)
    200190{
    201191    ASSERT(!m_isShutdown);
     
    203193
    204194    if (disabledByPrivateBrowsingInFrame(frame))
    205         return false;
     195        return;
    206196
    207197    if (!m_storageMap->length())
    208         return false;
     198        return;
    209199
    210200    unsigned quota = m_storageMap->quota();
     
    214204        m_storageAreaSync->scheduleClear();
    215205    StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
    216     return true;
    217206}
    218207
  • trunk/Source/WebCore/storage/StorageAreaImpl.h

    r99439 r116712  
    4747        virtual String key(unsigned index, Frame* sourceFrame) const;
    4848        virtual String getItem(const String& key, Frame* sourceFrame) const;
    49         virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
    50         virtual String removeItem(const String& key, Frame* sourceFrame);
    51         virtual bool clear(Frame* sourceFrame);
     49        virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
     50        virtual void removeItem(const String& key, Frame* sourceFrame);
     51        virtual void clear(Frame* sourceFrame);
    5252        virtual bool contains(const String& key, Frame* sourceFrame) const;
    5353
  • trunk/Source/WebKit/chromium/ChangeLog

    r116709 r116712  
     12012-05-10  Michael Nordman  <michaeln@google.com>
     2
     3        [chromium] DomStorage events handling needs TLC (2)
     4        https://bugs.webkit.org/show_bug.cgi?id=85221
     5        Alter the WebStorageArea virtual interface such that the mutators no longer
     6        return old values. This is to allow implementations of the interface to operate
     7        more asynchronously.
     8
     9        Also clean up from the last patch, remove support for the DEPRECATED event
     10        dispatching API.
     11
     12        Reviewed by Adam Barth.
     13
     14        * WebKit.gyp: delete three files indicated below
     15        * public/WebStorageArea.h:
     16        (WebKit::WebStorageArea::setItem): no longer returns the old value
     17        (WebKit::WebStorageArea::removeItem): no longer returns the old value
     18        (WebKit::WebStorageArea::clear): no longer returns a bool indicated if something was cleared
     19        * public/WebStorageEventDispatcher.h: removed the DEPRECATED instance methods
     20        * public/WebStorageNamespace.h: removed the DEPRECATED close() method
     21        * public/platform/WebKitPlatformSupport.h: removed the DEPRECATED dispatchStorageEvent() method
     22        * src/StorageAreaProxy.cpp: removed the DEPREACTED storageEvent() method
     23        (WebCore::StorageAreaProxy::setItem): no return value
     24        (WebCore::StorageAreaProxy::removeItem): no return value
     25        (WebCore::StorageAreaProxy::clear): no return value
     26        (WebCore::StorageAreaProxy::dispatchLocalStorageEvent): remove an early return thats no longer needed
     27        (WebCore::findPageWithSessionStorageNamespace): switched to passing pageGroup by ptr value instead of by name
     28        (WebCore::StorageAreaProxy::dispatchSessionStorageEvent): remove an early return thats no longer needed
     29        * src/StorageAreaProxy.h:
     30        (WebCore):
     31        (StorageAreaProxy):
     32        * src/StorageEventDispatcherImpl.cpp: Deleted the file.
     33        * src/StorageEventDispatcherImpl.h: Deleted the file.
     34        * src/WebStorageEventDispatcherImpl.cpp: Deleted the DEPRECATED instance methods.
     35        (WebKit::WebStorageEventDispatcher::dispatchLocalStorageEvent): use WebViewImpl::defaultPageGroup
     36        (WebKit::WebStorageEventDispatcher::dispatchSessionStorageEvent): use WebViewImpl::defaultPageGroup
     37        * src/WebStorageEventDispatcherImpl.h: Deleted the file.
     38        * src/WebViewImpl.cpp: added a static method to retrieve a ptr to the default page group,
     39        (WebKit::WebViewImpl::defaultPageGroup):
     40        * src/WebViewImpl.h:
     41
     42
    1432012-05-10  Anders Carlsson  <andersca@apple.com>
    244
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r116641 r116712  
    474474                'src/StorageAreaProxy.cpp',
    475475                'src/StorageAreaProxy.h',
    476                 'src/StorageEventDispatcherImpl.cpp',
    477                 'src/StorageEventDispatcherImpl.h',
    478476                'src/StorageInfoChromium.cpp',
    479477                'src/StorageNamespaceProxy.cpp',
     
    653651                'src/WebSpeechRecognitionResult.cpp',
    654652                'src/WebStorageEventDispatcherImpl.cpp',
    655                 'src/WebStorageEventDispatcherImpl.h',
    656653                'src/WebStorageQuotaCallbacksImpl.cpp',
    657654                'src/WebStorageQuotaCallbacksImpl.h',
  • trunk/Source/WebKit/chromium/public/WebStorageArea.h

    r101122 r116712  
    3939class WebURL;
    4040
    41 // In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This
    42 // class wraps a StorageArea.  All the methods have obvious connections to the spec:
    43 // http://dev.w3.org/html5/webstorage/
    4441class WebStorageArea {
    4542public:
     
    6461
    6562    // Set the value that corresponds to a specific key. Result will either be ResultOK
    66     // or some particular error. The value is NOT set when there's an error.  url is the
     63    // or some particular error. The value is NOT set when there's an error. |pageUrl| is the
    6764    // url that should be used if a storage event fires.
     65    virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& pageUrl, Result& result)
     66    {
     67        WebString unused;
     68        setItem(key, newValue, pageUrl, result, unused);
     69    }
     70
     71
     72    // Remove the value associated with a particular key. |pageUrl| is the url that should be used
     73    // if a storage event fires.
     74    virtual void removeItem(const WebString& key, const WebURL& pageUrl)
     75    {
     76        WebString unused;
     77        removeItem(key, pageUrl, unused);
     78    }
     79
     80    // Clear all key/value pairs. |pageUrl| is the url that should be used if a storage event fires.
     81    virtual void clear(const WebURL& pageUrl)
     82    {
     83        bool unused;
     84        clear(pageUrl, unused);
     85    }
     86
     87    // DEPRECATED - being replaced by the async variants above which do not return oldValues or block until completion.
    6888    virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0;
    69 
    70     // Remove the value associated with a particular key.  url is the url that should be used
    71     // if a storage event fires.
    72     virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue) = 0;
    73 
    74     // Clear all key/value pairs.  url is the url that should be used if a storage event fires.
    75     virtual void clear(const WebURL& url, bool& somethingCleared) = 0;
     89    virtual void removeItem(const WebString& key, const WebURL& pageUrl, WebString& oldValue) = 0;
     90    virtual void clear(const WebURL& pageUrl, bool& somethingCleared) = 0;
    7691};
    7792
  • trunk/Source/WebKit/chromium/public/WebStorageEventDispatcher.h

    r114993 r116712  
    5656            WebStorageArea* sourceAreaInstance, bool originatedInProcess);
    5757
    58     // DEPRECATED - The instance methods are going away soon in favor
    59     // of the two static dispatch methods above.
    60     WEBKIT_EXPORT static WebStorageEventDispatcher* create();
    61     virtual ~WebStorageEventDispatcher() { }
    62     virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
    63                                       const WebString& newValue, const WebString& origin,
    64                                       const WebURL& url, bool isLocalStorage) = 0;
     58 private:
     59    WebStorageEventDispatcher() { }
    6560};
    6661
  • trunk/Source/WebKit/chromium/public/WebStorageNamespace.h

    r114993 r116712  
    5656    // Returns true of the two instances represent the same storage namespace.
    5757    virtual bool isSameNamespace(const WebStorageNamespace&) const { return false; }
    58 
    59     // DEPRECATED
    60     virtual void close() { }
    6158};
    6259
  • trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h

    r116566 r116712  
    8888    // Return a LocalStorage namespace that corresponds to the following path.
    8989    virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; }
    90 
    91     // DEPRECATED
    92     virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
    93                                       const WebString& newValue, const WebString& origin,
    94                                       const WebURL& url, bool isLocalStorage) { }
    9590
    9691
  • trunk/Source/WebKit/chromium/src/StorageAreaProxy.cpp

    r114993 r116712  
    8181}
    8282
    83 String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
     83void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
    8484{
    85     WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK;
    86     WebKit::WebString oldValue;
    8785    if (!canAccessStorage(frame))
    8886        ec = QUOTA_EXCEEDED_ERR;
    8987    else {
    90         m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue);
     88        WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK;
     89        m_storageArea->setItem(key, value, frame->document()->url(), result);
    9190        ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR;
    92         String oldValueString = oldValue;
    93         if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK)
    94             storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame);
    9591    }
    96     return oldValue;
    9792}
    9893
    99 String StorageAreaProxy::removeItem(const String& key, Frame* frame)
     94void StorageAreaProxy::removeItem(const String& key, Frame* frame)
    10095{
    10196    if (!canAccessStorage(frame))
    102         return String();
    103     WebKit::WebString oldValue;
    104     m_storageArea->removeItem(key, frame->document()->url(), oldValue);
    105     if (!oldValue.isNull())
    106         storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame);
    107     return oldValue;
     97        return;
     98    m_storageArea->removeItem(key, frame->document()->url());
    10899}
    109100
    110 bool StorageAreaProxy::clear(Frame* frame)
     101void StorageAreaProxy::clear(Frame* frame)
    111102{
    112103    if (!canAccessStorage(frame))
    113         return false;
    114     bool clearedSomething;
    115     m_storageArea->clear(frame->document()->url(), clearedSomething);
    116     if (clearedSomething)
    117         storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame);
    118     return clearedSomething;
     104        return;
     105    m_storageArea->clear(frame->document()->url());
    119106}
    120107
     
    122109{
    123110    return !getItem(key, frame).isNull();
    124 }
    125 
    126 // FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done.
    127 // Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity.  It's probably best to keep it current.
    128 void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame)
    129 {
    130     Page* page = sourceFrame->page();
    131     if (!page)
    132         return;
    133 
    134     // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree
    135     // of any given page in the group or mutate the page group itself.
    136     Vector<RefPtr<Frame> > frames;
    137     if (storageType == SessionStorage) {
    138         // Send events only to our page.
    139         for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    140             if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    141                 frames.append(frame);
    142         }
    143 
    144         for (unsigned i = 0; i < frames.size(); ++i) {
    145             // FIXME: maybe only raise if the window has an onstorage listener
    146             // attached to avoid creating the Storage instance.
    147             ExceptionCode ec = 0;
    148             Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
    149             if (!ec)
    150                 frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    151         }
    152     } else {
    153         // Send events to every page.
    154         const HashSet<Page*>& pages = page->group().pages();
    155         HashSet<Page*>::const_iterator end = pages.end();
    156         for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
    157             for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    158                 if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    159                     frames.append(frame);
    160             }
    161         }
    162 
    163         for (unsigned i = 0; i < frames.size(); ++i) {
    164             // FIXME: maybe only raise if the window has an onstorage listener
    165             // attached to avoid creating the Storage instance.
    166             ExceptionCode ec = 0;
    167             Storage* storage = frames[i]->domWindow()->localStorage(ec);
    168             if (!ec)
    169                 frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    170         }
    171     }
    172111}
    173112
     
    181120}
    182121
    183 void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
     122void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue,
    184123                                                 SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
    185124{
    186     // FIXME: Multi-sided patch engineering alert !
    187     // step 1: this method gets defined and implemented in webkit/webcore with the early return.
    188     // step 2: this method starts getting called by chromium still with the early return.
    189     // step 3: This class's setters are modified to no longer raise SessionStorage
    190     //         events for inprocess changes and this early return is removed.
    191     if (originatedInProcess)
    192         return;
    193 
    194     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages();
     125    const HashSet<Page*>& pages = pageGroup->pages();
    195126    for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
    196127        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
     
    206137}
    207138
    208 static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace)
     139static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const WebKit::WebStorageNamespace& sessionNamespace)
    209140{
    210     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages();
     141    const HashSet<Page*>& pages = pageGroup->pages();
    211142    for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
    212143        const bool createIfNeeded = true;
     
    218149}
    219150
    220 void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
     151void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue,
    221152                                                   SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace,
    222153                                                   WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
    223154{
    224     // FIXME: Multi-sided patch engineering alert !
    225     // step 1: this method gets defined and implemented in webkit/webcore with the early return.
    226     // step 2: this method starts getting called by chromium still with the early return.
    227     // step 3: This class's setters are modified to no longer raise SessionStorage
    228     //         events for inprocess changes and this early return is removed.
    229     if (originatedInProcess)
    230         return;
    231 
    232     Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace);
     155    Page* page = findPageWithSessionStorageNamespace(pageGroup, sessionNamespace);
    233156    if (!page)
    234157        return;
  • trunk/Source/WebKit/chromium/src/StorageAreaProxy.h

    r114993 r116712  
    3939class KURL;
    4040class Page;
     41class PageGroup;
    4142class SecurityOrigin;
    4243class Storage;
     
    5152    virtual String key(unsigned index, Frame* sourceFrame) const;
    5253    virtual String getItem(const String& key, Frame* sourceFrame) const;
    53     virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
    54     virtual String removeItem(const String& key, Frame* sourceFrame);
    55     virtual bool clear(Frame* sourceFrame);
     54    virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
     55    virtual void removeItem(const String& key, Frame* sourceFrame);
     56    virtual void clear(Frame* sourceFrame);
    5657    virtual bool contains(const String& key, Frame* sourceFrame) const;
    5758
     
    5960
    6061    static void dispatchLocalStorageEvent(
    61             const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
     62            PageGroup*, const String& key, const String& oldValue, const String& newValue,
    6263            SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
    6364    static void dispatchSessionStorageEvent(
    64             const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
     65            PageGroup*, const String& key, const String& oldValue, const String& newValue,
    6566            SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&,
    6667            WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
    6768
    6869private:
    69     void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame);
    7070    bool canAccessStorage(Frame*) const;
    7171
  • trunk/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp

    r114993 r116712  
    3030
    3131#include "config.h"
    32 #include "WebStorageEventDispatcherImpl.h"
     32#include "WebStorageEventDispatcher.h"
    3333
    3434#include "KURL.h"
    3535#include "SecurityOrigin.h"
    3636#include "StorageAreaProxy.h"
     37#include "WebViewImpl.h"
    3738
    3839#include "platform/WebURL.h"
    3940#include <wtf/PassOwnPtr.h>
    4041
     42// FIXME: move this file to WebStorageEventDispatcher.cpp
     43
    4144namespace WebKit {
    42 
    43 extern const char* pageGroupName;
    4445
    4546void WebStorageEventDispatcher::dispatchLocalStorageEvent(
     
    5152    RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
    5253    WebCore::StorageAreaProxy::dispatchLocalStorageEvent(
    53             pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL,
     54            WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL,
    5455            sourceAreaInstance, originatedInProcess);
    5556}
     
    6364    RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
    6465    WebCore::StorageAreaProxy::dispatchSessionStorageEvent(
    65             pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL,
     66            WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL,
    6667            sessionNamespace, sourceAreaInstance, originatedInProcess);
    6768}
    6869
    69 
    70 // FIXME: remove the WebStorageEventDispatcherImpl class soon.
    71 
    72 WebStorageEventDispatcher* WebStorageEventDispatcher::create()
    73 {
    74     return new WebStorageEventDispatcherImpl();
    75 }
    76 
    77 WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl()
    78     : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGroupName)))
    79 {
    80     ASSERT(m_eventDispatcher);
    81 }
    82 
    83 void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue,
    84                                                          const WebString& newValue, const WebString& origin,
    85                                                          const WebURL& pageURL, bool isLocalStorage)
    86 {
    87     WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage;
    88     RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin);
    89     m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType);
    90 }
    91 
    9270} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r116671 r116712  
    12621262}
    12631263
     1264PageGroup* WebViewImpl::defaultPageGroup()
     1265{
     1266    return PageGroup::pageGroup(pageGroupName);
     1267}
     1268
    12641269// WebWidget ------------------------------------------------------------------
    12651270
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r114987 r116712  
    7070class KeyboardEvent;
    7171class Page;
     72class PageGroup;
    7273class PagePopup;
    7374class PagePopupClient;
     
    301302    static WebViewImpl* fromPage(WebCore::Page*);
    302303
     304    // A pageGroup identifies a namespace of pages. Page groups are used on PLATFORM(MAC)
     305    // for some programs that use HTML views to display things that don't seem like
     306    // web pages to the user (so shouldn't have visited link coloring). We only use
     307    // one page group.
     308    static WebCore::PageGroup* defaultPageGroup();
     309
    303310    WebViewClient* client()
    304311    {
Note: See TracChangeset for help on using the changeset viewer.