Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: Source/core/storage/StorageArea.cpp

Issue 898593002: DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed assertion Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All Rights Reserved. 2 * Copyright (C) 2009 Google Inc. All Rights Reserved.
3 * (C) 2008 Apple Inc. 3 * (C) 2008 Apple Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 for (Page* page : pages) { 167 for (Page* page : pages) {
168 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav erseNext()) { 168 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav erseNext()) {
169 // FIXME: We do not yet have a way to dispatch events to out-of-proc ess frames. 169 // FIXME: We do not yet have a way to dispatch events to out-of-proc ess frames.
170 if (!frame->isLocalFrame()) 170 if (!frame->isLocalFrame())
171 continue; 171 continue;
172 LocalFrame* localFrame = toLocalFrame(frame); 172 LocalFrame* localFrame = toLocalFrame(frame);
173 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); 173 LocalDOMWindow* localWindow = localFrame->localDOMWindow();
174 Storage* storage = DOMWindowStorage::from(*localWindow).optionalLoca lStorage(); 174 Storage* storage = DOMWindowStorage::from(*localWindow).optionalLoca lStorage();
175 if (storage && localFrame->document()->securityOrigin()->canAccess(s ecurityOrigin) && !isEventSource(storage, sourceAreaInstance)) 175 if (storage && localFrame->document()->securityOrigin()->canAccess(s ecurityOrigin) && !isEventSource(storage, sourceAreaInstance))
176 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::c reate(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); 176 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::c reate(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage));
177 InspectorInstrumentation::didDispatchDOMStorageEvent(localFrame, key , oldValue, newValue, LocalStorage, securityOrigin);
177 } 178 }
178 InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue , newValue, LocalStorage, securityOrigin);
179 } 179 }
180 } 180 }
181 181
182 static Page* findPageWithSessionStorageNamespace(const WebStorageNamespace& sess ionNamespace) 182 static Page* findPageWithSessionStorageNamespace(const WebStorageNamespace& sess ionNamespace)
183 { 183 {
184 // FIXME: This looks suspicious. Why doesn't this use allPages instead? 184 // FIXME: This looks suspicious. Why doesn't this use allPages instead?
185 const HashSet<Page*>& pages = Page::ordinaryPages(); 185 const HashSet<Page*>& pages = Page::ordinaryPages();
186 for (Page* page : pages) { 186 for (Page* page : pages) {
187 const bool dontCreateIfMissing = false; 187 const bool dontCreateIfMissing = false;
188 StorageNamespace* storageNamespace = StorageNamespaceController::from(pa ge)->sessionStorage(dontCreateIfMissing); 188 StorageNamespace* storageNamespace = StorageNamespaceController::from(pa ge)->sessionStorage(dontCreateIfMissing);
(...skipping 11 matching lines...) Expand all
200 200
201 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverse Next()) { 201 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverse Next()) {
202 // FIXME: We do not yet have a way to dispatch events to out-of-process frames. 202 // FIXME: We do not yet have a way to dispatch events to out-of-process frames.
203 if (!frame->isLocalFrame()) 203 if (!frame->isLocalFrame())
204 continue; 204 continue;
205 LocalFrame* localFrame = toLocalFrame(frame); 205 LocalFrame* localFrame = toLocalFrame(frame);
206 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); 206 LocalDOMWindow* localWindow = localFrame->localDOMWindow();
207 Storage* storage = DOMWindowStorage::from(*localWindow).optionalSessionS torage(); 207 Storage* storage = DOMWindowStorage::from(*localWindow).optionalSessionS torage();
208 if (storage && localFrame->document()->securityOrigin()->canAccess(secur ityOrigin) && !isEventSource(storage, sourceAreaInstance)) 208 if (storage && localFrame->document()->securityOrigin()->canAccess(secur ityOrigin) && !isEventSource(storage, sourceAreaInstance))
209 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::creat e(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); 209 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::creat e(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage));
210 InspectorInstrumentation::didDispatchDOMStorageEvent(localFrame, key, ol dValue, newValue, SessionStorage, securityOrigin);
210 } 211 }
211 InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue, ne wValue, SessionStorage, securityOrigin);
212 } 212 }
213 213
214 bool StorageArea::isEventSource(Storage* storage, WebStorageArea* sourceAreaInst ance) 214 bool StorageArea::isEventSource(Storage* storage, WebStorageArea* sourceAreaInst ance)
215 { 215 {
216 ASSERT(storage); 216 ASSERT(storage);
217 StorageArea* area = storage->area(); 217 StorageArea* area = storage->area();
218 return area->m_storageArea == sourceAreaInstance; 218 return area->m_storageArea == sourceAreaInstance;
219 } 219 }
220 220
221 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698