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

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

Issue 552733003: Oilpan: make DOMWindowProperty a GC mixin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pacify GC plugin wrt LocalDOMWindow::trace() 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 , m_associatedDOMWindow(0) 37 , m_associatedDOMWindow(nullptr)
38 { 38 {
39 // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created w ith a null frame. 39 // 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. 40 // See fast/dom/navigator-detached-no-crash.html for the recipe.
41 // We should fix that. <rdar://problem/11567132> 41 // We should fix that. <rdar://problem/11567132>
42 if (m_frame) { 42 if (m_frame) {
43 m_associatedDOMWindow = m_frame->domWindow(); 43 m_associatedDOMWindow = m_frame->domWindow();
44 m_associatedDOMWindow->registerProperty(this); 44 m_associatedDOMWindow->registerProperty(this);
45 } 45 }
46 } 46 }
47 47
48 #if !ENABLE(OILPAN)
48 DOMWindowProperty::~DOMWindowProperty() 49 DOMWindowProperty::~DOMWindowProperty()
49 { 50 {
50 if (m_associatedDOMWindow) 51 if (m_associatedDOMWindow)
51 m_associatedDOMWindow->unregisterProperty(this); 52 m_associatedDOMWindow->unregisterProperty(this);
52 53
53 m_associatedDOMWindow = 0; 54 m_associatedDOMWindow = nullptr;
54 m_frame = 0; 55 m_frame = nullptr;
55 } 56 }
57 #endif
56 58
57 void DOMWindowProperty::willDestroyGlobalObjectInFrame() 59 void DOMWindowProperty::willDestroyGlobalObjectInFrame()
58 { 60 {
59 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them. 61 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them.
60 ASSERT(m_frame); 62 ASSERT(m_frame);
61 ASSERT(m_associatedDOMWindow); 63 ASSERT(m_associatedDOMWindow);
62 64
63 // DOMWindowProperty lifetime isn't tied directly to the LocalDOMWindow itse lf so it is important that it unregister 65 // DOMWindowProperty lifetime isn't tied directly to the LocalDOMWindow itse lf so it is important that it unregister
64 // itself from any LocalDOMWindow it is associated with if that LocalDOMWind ow is going away. 66 // itself from any LocalDOMWindow it is associated with if that LocalDOMWind ow is going away.
65 if (m_associatedDOMWindow) 67 if (m_associatedDOMWindow)
66 m_associatedDOMWindow->unregisterProperty(this); 68 m_associatedDOMWindow->unregisterProperty(this);
67 m_associatedDOMWindow = 0; 69 m_associatedDOMWindow = nullptr;
68 m_frame = 0; 70 m_frame = nullptr;
69 } 71 }
70 72
71 void DOMWindowProperty::willDetachGlobalObjectFromFrame() 73 void DOMWindowProperty::willDetachGlobalObjectFromFrame()
72 { 74 {
73 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them. 75 // If the property is getting this callback it must have been created with a LocalFrame/LocalDOMWindow and it should still have them.
74 ASSERT(m_frame); 76 ASSERT(m_frame);
75 ASSERT(m_associatedDOMWindow); 77 ASSERT(m_associatedDOMWindow);
76 } 78 }
77 79
80 void DOMWindowProperty::trace(Visitor* visitor)
81 {
82 visitor->trace(m_associatedDOMWindow);
78 } 83 }
84
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698