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

Side by Side Diff: third_party/WebKit/Source/modules/storage/StorageArea.cpp

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 years 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
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 WebStorageArea* sourceAreaInstance) { 167 WebStorageArea* sourceAreaInstance) {
168 // Iterate over all pages that have a StorageNamespaceController supplement. 168 // Iterate over all pages that have a StorageNamespaceController supplement.
169 for (Page* page : Page::ordinaryPages()) { 169 for (Page* page : Page::ordinaryPages()) {
170 for (Frame* frame = page->mainFrame(); frame; 170 for (Frame* frame = page->mainFrame(); frame;
171 frame = frame->tree().traverseNext()) { 171 frame = frame->tree().traverseNext()) {
172 // FIXME: We do not yet have a way to dispatch events to out-of-process 172 // FIXME: We do not yet have a way to dispatch events to out-of-process
173 // frames. 173 // frames.
174 if (!frame->isLocalFrame()) 174 if (!frame->isLocalFrame())
175 continue; 175 continue;
176 LocalFrame* localFrame = toLocalFrame(frame); 176 LocalFrame* localFrame = toLocalFrame(frame);
177 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); 177 LocalDOMWindow* localWindow = localFrame->domWindow();
178 Storage* storage = 178 Storage* storage =
179 DOMWindowStorage::from(*localWindow).optionalLocalStorage(); 179 DOMWindowStorage::from(*localWindow).optionalLocalStorage();
180 if (storage && 180 if (storage &&
181 localFrame->document()->getSecurityOrigin()->canAccess( 181 localFrame->document()->getSecurityOrigin()->canAccess(
182 securityOrigin) && 182 securityOrigin) &&
183 !isEventSource(storage, sourceAreaInstance)) 183 !isEventSource(storage, sourceAreaInstance))
184 localFrame->localDOMWindow()->enqueueWindowEvent( 184 localFrame->domWindow()->enqueueWindowEvent(
185 StorageEvent::create(EventTypeNames::storage, key, oldValue, 185 StorageEvent::create(EventTypeNames::storage, key, oldValue,
186 newValue, pageURL, storage)); 186 newValue, pageURL, storage));
187 } 187 }
188 if (InspectorDOMStorageAgent* agent = 188 if (InspectorDOMStorageAgent* agent =
189 StorageNamespaceController::from(page)->inspectorAgent()) 189 StorageNamespaceController::from(page)->inspectorAgent())
190 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, LocalStorage, 190 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, LocalStorage,
191 securityOrigin); 191 securityOrigin);
192 } 192 }
193 } 193 }
194 194
(...skipping 23 matching lines...) Expand all
218 if (!page) 218 if (!page)
219 return; 219 return;
220 220
221 for (Frame* frame = page->mainFrame(); frame; 221 for (Frame* frame = page->mainFrame(); frame;
222 frame = frame->tree().traverseNext()) { 222 frame = frame->tree().traverseNext()) {
223 // FIXME: We do not yet have a way to dispatch events to out-of-process 223 // FIXME: We do not yet have a way to dispatch events to out-of-process
224 // frames. 224 // frames.
225 if (!frame->isLocalFrame()) 225 if (!frame->isLocalFrame())
226 continue; 226 continue;
227 LocalFrame* localFrame = toLocalFrame(frame); 227 LocalFrame* localFrame = toLocalFrame(frame);
228 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); 228 LocalDOMWindow* localWindow = localFrame->domWindow();
229 Storage* storage = 229 Storage* storage =
230 DOMWindowStorage::from(*localWindow).optionalSessionStorage(); 230 DOMWindowStorage::from(*localWindow).optionalSessionStorage();
231 if (storage && 231 if (storage &&
232 localFrame->document()->getSecurityOrigin()->canAccess( 232 localFrame->document()->getSecurityOrigin()->canAccess(
233 securityOrigin) && 233 securityOrigin) &&
234 !isEventSource(storage, sourceAreaInstance)) 234 !isEventSource(storage, sourceAreaInstance))
235 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::create( 235 localFrame->domWindow()->enqueueWindowEvent(StorageEvent::create(
236 EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); 236 EventTypeNames::storage, key, oldValue, newValue, pageURL, storage));
237 } 237 }
238 if (InspectorDOMStorageAgent* agent = 238 if (InspectorDOMStorageAgent* agent =
239 StorageNamespaceController::from(page)->inspectorAgent()) 239 StorageNamespaceController::from(page)->inspectorAgent())
240 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, 240 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage,
241 securityOrigin); 241 securityOrigin);
242 } 242 }
243 243
244 bool StorageArea::isEventSource(Storage* storage, 244 bool StorageArea::isEventSource(Storage* storage,
245 WebStorageArea* sourceAreaInstance) { 245 WebStorageArea* sourceAreaInstance) {
246 ASSERT(storage); 246 ASSERT(storage);
247 StorageArea* area = storage->area(); 247 StorageArea* area = storage->area();
248 return area->m_storageArea.get() == sourceAreaInstance; 248 return area->m_storageArea.get() == sourceAreaInstance;
249 } 249 }
250 250
251 } // namespace blink 251 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698