Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h (working copy)
- @@ -43,6 +43,7 @@
- public:
- // Dispatch a local storage event to appropiate documents.
- WEBKIT_EXPORT static void dispatchLocalStorageEvent(
- + int storageAction,
- const WebString& key, const WebString& oldValue,
- const WebString& newValue, const WebURL& origin,
- const WebURL& pageUrl, WebStorageArea* sourceAreaInstance,
- @@ -50,6 +51,7 @@
- // Dispatch a session storage event to appropiate documents.
- WEBKIT_EXPORT static void dispatchSessionStorageEvent(
- + int storageAction,
- const WebString& key, const WebString& oldValue,
- const WebString& newValue, const WebURL& origin,
- const WebURL& pageUrl, const WebStorageNamespace&,
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp (working copy)
- @@ -41,6 +41,7 @@
- namespace WebKit {
- void WebStorageEventDispatcher::dispatchLocalStorageEvent(
- + int storageAction,
- const WebString& key, const WebString& oldValue,
- const WebString& newValue, const WebURL& origin,
- const WebURL& pageURL, WebStorageArea* sourceAreaInstance,
- @@ -48,11 +49,12 @@
- {
- RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
- WebCore::StorageAreaProxy::dispatchLocalStorageEvent(
- - WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL,
- + WebViewImpl::defaultPageGroup(), storageAction, key, oldValue, newValue, securityOrigin.get(), pageURL,
- sourceAreaInstance, originatedInProcess);
- }
- void WebStorageEventDispatcher::dispatchSessionStorageEvent(
- + int storageAction,
- const WebString& key, const WebString& oldValue,
- const WebString& newValue, const WebURL& origin,
- const WebURL& pageURL, const WebStorageNamespace& sessionNamespace,
- @@ -60,7 +62,7 @@
- {
- RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
- WebCore::StorageAreaProxy::dispatchSessionStorageEvent(
- - WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL,
- + WebViewImpl::defaultPageGroup(), storageAction, key, oldValue, newValue, securityOrigin.get(), pageURL,
- sessionNamespace, sourceAreaInstance, originatedInProcess);
- }
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.h
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.h (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.h (working copy)
- @@ -61,10 +61,10 @@
- virtual size_t memoryBytesUsedByCache() const;
- static void dispatchLocalStorageEvent(
- - PageGroup*, const String& key, const String& oldValue, const String& newValue,
- + PageGroup*, int storageAction, const String& key, const String& oldValue, const String& newValue,
- SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
- static void dispatchSessionStorageEvent(
- - PageGroup*, const String& key, const String& oldValue, const String& newValue,
- + PageGroup*, int storageAction, const String& key, const String& oldValue, const String& newValue,
- SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&,
- WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebKit/chromium/src/StorageAreaProxy.cpp (working copy)
- @@ -151,9 +151,21 @@
- return m_storageArea->memoryBytesUsedByCache();
- }
- -void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue,
- +void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, int action, const String& key, const String& oldValue, const String& newValue,
- SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
- {
- + String storageAction;
- + switch(action) {
- + case 0:
- + storageAction = "ItemSet";
- + break;
- + case 1:
- + storageAction = "ItemRemoved";
- + break;
- + case 2:
- + storageAction = "ItemsCleared";
- + break;
- + }
- const HashSet<Page*>& pages = pageGroup->pages();
- for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
- for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- @@ -161,7 +173,8 @@
- if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
- frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
- }
- - InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, LocalStorage, securityOrigin, *it);
- +
- + InspectorInstrumentation::didDispatchDOMStorageEvent(storageAction, key, oldValue, newValue, LocalStorage, securityOrigin, *it);
- }
- }
- @@ -177,7 +190,7 @@
- return 0;
- }
- -void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue,
- +void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, int action, const String& key, const String& oldValue, const String& newValue,
- SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace,
- WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
- {
- @@ -185,12 +198,25 @@
- if (!page)
- return;
- + String storageAction;
- + switch(action) {
- + case 0:
- + storageAction = "ItemSet";
- + break;
- + case 1:
- + storageAction = "ItemRemoved";
- + break;
- + case 2:
- + storageAction = "ItemsCleared";
- + break;
- + }
- +
- for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- Storage* storage = frame->document()->domWindow()->optionalSessionStorage();
- if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
- frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
- }
- - InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, securityOrigin, page);
- + InspectorInstrumentation::didDispatchDOMStorageEvent(storageAction, key, oldValue, newValue, SessionStorage, securityOrigin, page);
- }
- bool StorageAreaProxy::isEventSource(Storage* storage, WebKit::WebStorageArea* sourceAreaInstance)
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (working copy)
- @@ -205,7 +205,7 @@
- resource->bind(m_frontend);
- }
- -void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String&, const String&, const String&, StorageType storageType, SecurityOrigin* securityOrigin, Page*)
- +void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page*)
- {
- if (!m_frontend || !m_enabled)
- return;
- @@ -215,7 +215,7 @@
- if (id.isEmpty())
- return;
- - m_frontend->domstorage()->domStorageUpdated(id);
- + m_frontend->domstorage()->domStorageUpdated(id, storageAction, key, oldValue, newValue);
- }
- void InspectorDOMStorageAgent::clearResources()
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.h
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.h (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorDOMStorageAgent.h (working copy)
- @@ -76,7 +76,7 @@
- // Called from InspectorInstrumentation
- void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*);
- - void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- + void didDispatchDOMStorageEvent(const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/front-end/DOMStorage.js
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/front-end/DOMStorage.js (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/front-end/DOMStorage.js (working copy)
- @@ -166,8 +166,10 @@
- /**
- * @param {string} storageId
- */
- - domStorageUpdated: function(storageId)
- + domStorageUpdated: function(storageId, storageAction, key, oldValue, newValue)
- {
- + var expression = "console.log(\""+storageAction+" " +key+" " + oldValue +" "+newValue +"\");";
- + WebInspector.evaluateInConsole(expression, true);
- this._model._domStorageUpdated(storageId);
- }
- }
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.cpp (working copy)
- @@ -1111,10 +1111,10 @@
- domStorageAgent->didUseDOMStorage(storageArea, isLocalStorage, frame);
- }
- -void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents* instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
- +void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents* instrumentingAgents, const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
- {
- if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
- - domStorageAgent->didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
- + domStorageAgent->didDispatchDOMStorageEvent(storageAction, key, oldValue, newValue, storageType, securityOrigin, page);
- }
- #if ENABLE(WORKERS)
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/Inspector.json
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/Inspector.json (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/Inspector.json (working copy)
- @@ -1473,7 +1473,11 @@
- {
- "name": "domStorageUpdated",
- "parameters": [
- - { "name": "storageId", "$ref": "StorageId" }
- + { "name": "storageId", "$ref": "StorageId" },
- + { "name": "storageAction", "type": "string" },
- + { "name": "key", "type": "string" },
- + { "name": "oldValue", "type": "string" },
- + { "name": "newValue", "type": "string" }
- ]
- }
- ]
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.h
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.h (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/inspector/InspectorInstrumentation.h (working copy)
- @@ -251,7 +251,7 @@
- #endif
- static void didUseDOMStorage(Page*, StorageArea*, bool isLocalStorage, Frame*);
- - static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- + static void didDispatchDOMStorageEvent(const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- #if ENABLE(WORKERS)
- static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*);
- @@ -451,7 +451,7 @@
- #endif
- static void didUseDOMStorageImpl(InstrumentingAgents*, StorageArea*, bool isLocalStorage, Frame*);
- - static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- + static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
- #if ENABLE(WORKERS)
- static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
- @@ -1761,13 +1761,14 @@
- #endif
- }
- -inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
- +inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& storageAction, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
- {
- #if ENABLE(INSPECTOR)
- FAST_RETURN_IF_NO_FRONTENDS(void());
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
- - didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
- + didDispatchDOMStorageEventImpl(instrumentingAgents, storageAction, key, oldValue, newValue, storageType, securityOrigin, page);
- #else
- + UNUSED_PARAM(storageAction);
- UNUSED_PARAM(key);
- UNUSED_PARAM(oldValue);
- UNUSED_PARAM(newValue);
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageAreaImpl.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageAreaImpl.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageAreaImpl.cpp (working copy)
- @@ -61,8 +61,8 @@
- ASSERT(isMainThread());
- ASSERT(m_securityOrigin);
- ASSERT(m_storageMap);
- -
- - // Accessing the shared global StorageTracker when a StorageArea is created
- +
- + // Accessing the shared global StorageTracker when a StorageArea is created
- // ensures that the tracker is properly initialized before anyone actually needs to use it.
- StorageTracker::tracker();
- }
- @@ -199,7 +199,7 @@
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, value);
- - StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
- + StorageEventDispatcher::dispatch(StorageEventDispatcher::ItemSet, key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
- }
- void StorageAreaImpl::removeItem(const String& key, ExceptionCode& ec, Frame* frame)
- @@ -226,7 +226,7 @@
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, String());
- - StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
- + StorageEventDispatcher::dispatch(StorageEventDispatcher::ItemRemoved, key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
- }
- void StorageAreaImpl::clear(ExceptionCode& ec, Frame* frame)
- @@ -251,7 +251,7 @@
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleClear();
- - StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
- + StorageEventDispatcher::dispatch(StorageEventDispatcher::ItemsCleared, String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
- }
- bool StorageAreaImpl::contains(const String& key, ExceptionCode& ec, Frame* frame) const
- @@ -290,7 +290,7 @@
- {
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
- -
- +
- if (m_storageMap->length()) {
- unsigned quota = m_storageMap->quota();
- m_storageMap = StorageMap::create(quota);
- @@ -301,12 +301,12 @@
- m_storageAreaSync->scheduleCloseDatabase();
- }
- }
- -
- +
- void StorageAreaImpl::sync()
- {
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
- -
- +
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleSync();
- }
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.h
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.h (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.h (working copy)
- @@ -37,8 +37,15 @@
- class StorageEventDispatcher {
- public:
- - static void dispatch(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame);
- + typedef enum {
- + ItemSet,
- + ItemRemoved,
- + ItemsCleared
- + } StorageAction;
- +
- + static void dispatch(StorageEventDispatcher::StorageAction action, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame);
- +
- private:
- // Do not instantiate.
- StorageEventDispatcher();
- Index: /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.cpp
- ===================================================================
- --- /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.cpp (revision 140854)
- +++ /home/user/workspace/chromium/src/third_party/WebKit/Source/WebCore/storage/StorageEventDispatcher.cpp (working copy)
- @@ -38,12 +38,25 @@
- namespace WebCore {
- -void StorageEventDispatcher::dispatch(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame)
- +void StorageEventDispatcher::dispatch(StorageEventDispatcher::StorageAction action, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame)
- {
- Page* page = sourceFrame->page();
- if (!page)
- return;
- + String stoageAction;
- + switch(action) {
- + case ItemSet:
- + storageAction = "ItemSet";
- + break;
- + case ItemRemoved:
- + storageAction = "ItemRemoved";
- + break;
- + case ItemsCleared:
- + storageAction = "ItemsCleared";
- + break;
- + }
- +
- // 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
- // of any given page in the group or mutate the page group itself.
- Vector<RefPtr<Frame> > frames;
- @@ -53,7 +66,7 @@
- if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
- frames.append(frame);
- }
- - InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
- + InspectorInstrumentation::didDispatchDOMStorageEvent(storageAction, key, oldValue, newValue, storageType, securityOrigin, page);
- for (unsigned i = 0; i < frames.size(); ++i) {
- ExceptionCode ec = 0;
- @@ -70,7 +83,7 @@
- if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
- frames.append(frame);
- }
- - InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, *it);
- + InspectorInstrumentation::didDispatchDOMStorageEvent(storageAction, key, oldValue, newValue, storageType, securityOrigin, *it);
- }
- for (unsigned i = 0; i < frames.size(); ++i) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement