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

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

Issue 558213002: Simplify DOMWindowProperty and its unregistration. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Iterate instead Created 6 years, 3 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
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 void LocalDOMWindow::willDetachFrameHost() 550 void LocalDOMWindow::willDetachFrameHost()
551 { 551 {
552 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); 552 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
553 m_frame->console().messageStorage()->frameWindowDiscarded(this); 553 m_frame->console().messageStorage()->frameWindowDiscarded(this);
554 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); 554 InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
555 } 555 }
556 556
557 void LocalDOMWindow::willDestroyDocumentInFrame() 557 void LocalDOMWindow::willDestroyDocumentInFrame()
558 { 558 {
559 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may 559 for (WillBeHeapHashSet<RawPtrWillBeMember<DOMWindowProperty> >::const_iterat or it = m_properties.begin(); it != m_properties.end(); ++it)
560 // unregister themselves from the LocalDOMWindow as a result of the call to willDestroyGlobalObjectInFrame. 560 (*it)->willDestroyGlobalObjectInFrame();
561 WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties;
562 copyToVector(m_properties, properties);
563 for (size_t i = 0; i < properties.size(); ++i)
564 properties[i]->willDestroyGlobalObjectInFrame();
565 } 561 }
566 562
567 void LocalDOMWindow::willDetachDocumentFromFrame() 563 void LocalDOMWindow::willDetachDocumentFromFrame()
568 { 564 {
569 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may 565 for (WillBeHeapHashSet<RawPtrWillBeMember<DOMWindowProperty> >::const_iterat or it = m_properties.begin(); it != m_properties.end(); ++it)
570 // unregister themselves from the LocalDOMWindow as a result of the call to willDetachGlobalObjectFromFrame. 566 (*it)->willDetachGlobalObjectFromFrame();
571 WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties;
572 copyToVector(m_properties, properties);
573 for (size_t i = 0; i < properties.size(); ++i)
574 properties[i]->willDetachGlobalObjectFromFrame();
575 } 567 }
576 568
577 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) 569 void LocalDOMWindow::registerProperty(DOMWindowProperty* property)
578 { 570 {
579 m_properties.add(property); 571 m_properties.add(property);
580 } 572 }
581 573
582 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property)
583 {
584 m_properties.remove(property);
585 }
586
587 void LocalDOMWindow::reset() 574 void LocalDOMWindow::reset()
588 { 575 {
589 willDestroyDocumentInFrame(); 576 willDestroyDocumentInFrame();
590 m_properties.clear(); 577 m_properties.clear();
591 578
592 m_screen = nullptr; 579 m_screen = nullptr;
593 m_history = nullptr; 580 m_history = nullptr;
594 m_locationbar = nullptr; 581 m_locationbar = nullptr;
595 m_menubar = nullptr; 582 m_menubar = nullptr;
596 m_personalbar = nullptr; 583 m_personalbar = nullptr;
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 LifecycleContext<LocalDOMWindow>::trace(visitor); 1907 LifecycleContext<LocalDOMWindow>::trace(visitor);
1921 } 1908 }
1922 1909
1923 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1910 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1924 { 1911 {
1925 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1912 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1926 return v8::Handle<v8::Object>(); 1913 return v8::Handle<v8::Object>();
1927 } 1914 }
1928 1915
1929 } // namespace blink 1916 } // namespace blink
OLDNEW
« Source/core/frame/LocalDOMWindow.h ('K') | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698