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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2003593003: Make CustomElementsRegistry lazily initialize script state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Does not use a separate representation of initialized state. Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 return document->requestIdleCallback(callback, options); 1324 return document->requestIdleCallback(callback, options);
1325 return 0; 1325 return 0;
1326 } 1326 }
1327 1327
1328 void LocalDOMWindow::cancelIdleCallback(int id) 1328 void LocalDOMWindow::cancelIdleCallback(int id)
1329 { 1329 {
1330 if (Document* document = this->document()) 1330 if (Document* document = this->document())
1331 document->cancelIdleCallback(id); 1331 document->cancelIdleCallback(id);
1332 } 1332 }
1333 1333
1334 CustomElementsRegistry* LocalDOMWindow::customElements(ScriptState* scriptState) const 1334 CustomElementsRegistry* LocalDOMWindow::customElementsForBindings(ScriptState* s criptState) const
1335 { 1335 {
1336 if (!scriptState->world().isMainWorld()) 1336 if (!scriptState->world().isMainWorld())
1337 return nullptr; 1337 return nullptr;
1338 return &customElements();
1339 }
1340
1341 CustomElementsRegistry& LocalDOMWindow::customElements() const
1342 {
1338 if (!m_customElements) 1343 if (!m_customElements)
1339 m_customElements = CustomElementsRegistry::create(scriptState, document( )->registrationContext()); 1344 m_customElements = CustomElementsRegistry::create(document()->registrati onContext());
1340 return m_customElements.get(); 1345 return *m_customElements.get();
1341 } 1346 }
1342 1347
1343 void LocalDOMWindow::addedEventListener(const AtomicString& eventType, Registere dEventListener& registeredListener) 1348 void LocalDOMWindow::addedEventListener(const AtomicString& eventType, Registere dEventListener& registeredListener)
1344 { 1349 {
1345 DOMWindow::addedEventListener(eventType, registeredListener); 1350 DOMWindow::addedEventListener(eventType, registeredListener);
1346 if (frame() && frame()->host()) 1351 if (frame() && frame()->host())
1347 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype, registeredListener.options()); 1352 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype, registeredListener.options());
1348 1353
1349 if (Document* document = this->document()) 1354 if (Document* document = this->document())
1350 document->addListenerTypeIfNeeded(eventType); 1355 document->addListenerTypeIfNeeded(eventType);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 { 1542 {
1538 // If the LocalDOMWindow still has a frame reference, that frame must point 1543 // If the LocalDOMWindow still has a frame reference, that frame must point
1539 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1544 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1540 // where script execution leaks between different LocalDOMWindows. 1545 // where script execution leaks between different LocalDOMWindows.
1541 if (m_frameObserver->frame()) 1546 if (m_frameObserver->frame())
1542 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1547 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1543 return m_frameObserver->frame(); 1548 return m_frameObserver->frame();
1544 } 1549 }
1545 1550
1546 } // namespace blink 1551 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698