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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back out non-Oilpan experiment + tidy up by adding frame() ref accessors 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved.
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 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/frame/DOMWindowProperty.h" 28 #include "core/frame/DOMWindowProperty.h"
29 29
30 #include "core/frame/LocalDOMWindow.h" 30 #include "core/frame/LocalDOMWindow.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 DOMWindowProperty::DOMWindowProperty(LocalFrame* frame) 35 DOMWindowProperty::DOMWindowProperty(LocalFrame* frame)
36 : m_frame(frame) 36 : m_frame(frame)
37 #if !ENABLE(OILPAN)
37 , m_associatedDOMWindow(nullptr) 38 , m_associatedDOMWindow(nullptr)
39 #endif
38 { 40 {
39 // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created w ith a null frame. 41 // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created w ith a null frame.
40 // See fast/dom/navigator-detached-no-crash.html for the recipe. 42 // See fast/dom/navigator-detached-no-crash.html for the recipe.
41 // We should fix that. <rdar://problem/11567132> 43 // We should fix that. <rdar://problem/11567132>
42 if (m_frame) { 44 if (m_frame) {
45 #if ENABLE(OILPAN)
46 m_frame->domWindow()->registerProperty(this);
47 #else
43 m_associatedDOMWindow = m_frame->domWindow(); 48 m_associatedDOMWindow = m_frame->domWindow();
44 m_associatedDOMWindow->registerProperty(this); 49 m_associatedDOMWindow->registerProperty(this);
50 #endif
45 } 51 }
46 } 52 }
47 53
48 #if !ENABLE(OILPAN) 54 #if !ENABLE(OILPAN)
49 DOMWindowProperty::~DOMWindowProperty() 55 DOMWindowProperty::~DOMWindowProperty()
50 { 56 {
51 if (m_associatedDOMWindow) 57 if (m_associatedDOMWindow)
52 m_associatedDOMWindow->unregisterProperty(this); 58 m_associatedDOMWindow->unregisterProperty(this);
53 } 59 }
54 #endif 60 #endif
55 61
56 void DOMWindowProperty::willDestroyGlobalObjectInFrame() 62 void DOMWindowProperty::willDestroyGlobalObjectInFrame()
57 { 63 {
58 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them. 64 // If the property is getting this callback it must have been
65 // created with a LocalFrame and it should still have it.
59 ASSERT(m_frame); 66 ASSERT(m_frame);
60 ASSERT(m_associatedDOMWindow); 67 m_frame = nullptr;
61 68
69 #if !ENABLE(OILPAN)
62 // LocalDOMWindow will along with notifying DOMWindowProperty objects of 70 // LocalDOMWindow will along with notifying DOMWindowProperty objects of
63 // impending destruction, unilaterally clear out its registered set. 71 // impending destruction, unilaterally clear out its registered set.
64 // Consequently, no explicit unregisteration required by DOMWindowProperty; 72 // Consequently, no explicit unregisteration required by DOMWindowProperty;
65 // here or when finalized. 73 // here or when destructed.
74 ASSERT(m_associatedDOMWindow);
66 m_associatedDOMWindow = nullptr; 75 m_associatedDOMWindow = nullptr;
67 m_frame = nullptr; 76 #endif
68 } 77 }
69 78
70 void DOMWindowProperty::willDetachGlobalObjectFromFrame() 79 void DOMWindowProperty::willDetachGlobalObjectFromFrame()
71 { 80 {
72 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them. 81 // If the property is getting this callback it must have been
82 // created with a LocalFrame and it should still have it.
73 ASSERT(m_frame); 83 ASSERT(m_frame);
84 #if !ENABLE(OILPAN)
85 // Ditto for its associated LocalDOMWindow.
74 ASSERT(m_associatedDOMWindow); 86 ASSERT(m_associatedDOMWindow);
87 #endif
75 } 88 }
76 89
77 void DOMWindowProperty::trace(Visitor* visitor) 90 void DOMWindowProperty::trace(Visitor* visitor)
78 { 91 {
79 visitor->trace(m_associatedDOMWindow); 92 visitor->trace(m_frame);
80 } 93 }
81 94
82 } 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698