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

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

Issue 569643002: Simplify and weaken DOMWindowProperty unregistration (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test 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
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | 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) 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<RawPtrWillBeWeakMember<DOMWindowProperty> >::const_it erator 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;
Mads Ager (chromium) 2014/09/15 07:58:21 Do you still need the copy for the non-oilpan case
sof 2014/09/15 08:10:25 No implementation of willDestroyGlobalObjectInFram
Mads Ager (chromium) 2014/09/15 08:11:40 Sounds good. Thanks for double checking and explai
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<RawPtrWillBeWeakMember<DOMWindowProperty> >::const_it erator 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;
Mads Ager (chromium) 2014/09/15 07:58:21 Ditto.
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) 574 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property)
583 { 575 {
584 m_properties.remove(property); 576 m_properties.remove(property);
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 LifecycleContext<LocalDOMWindow>::trace(visitor); 1912 LifecycleContext<LocalDOMWindow>::trace(visitor);
1921 } 1913 }
1922 1914
1923 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1915 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1924 { 1916 {
1925 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1917 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1926 return v8::Handle<v8::Object>(); 1918 return v8::Handle<v8::Object>();
1927 } 1919 }
1928 1920
1929 } // namespace blink 1921 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698