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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp

Issue 2744483002: Move asserts for tracking global object detachment to WindowProxy. (Closed)
Patch Set: Created 3 years, 9 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) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56). 63 // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56).
64 // We need to figure out why m_globalProxy != context->Global(). 64 // We need to figure out why m_globalProxy != context->Global().
65 DCHECK(m_globalProxy == context->Global()); 65 DCHECK(m_globalProxy == context->Global());
66 DCHECK_EQ(toScriptWrappable(context->Global()), 66 DCHECK_EQ(toScriptWrappable(context->Global()),
67 toScriptWrappable( 67 toScriptWrappable(
68 context->Global()->GetPrototype().As<v8::Object>())); 68 context->Global()->GetPrototype().As<v8::Object>()));
69 m_globalProxy.get().SetWrapperClassId(0); 69 m_globalProxy.get().SetWrapperClassId(0);
70 } 70 }
71 V8DOMWrapper::clearNativeInfo(isolate(), context->Global()); 71 V8DOMWrapper::clearNativeInfo(isolate(), context->Global());
72 m_scriptState->detachGlobalObject(); 72 m_scriptState->detachGlobalObject();
73
74 #if DCHECK_IS_ON()
75 didDetachGlobalProxy();
76 #endif
73 } 77 }
74 78
75 m_scriptState->disposePerContextData(); 79 m_scriptState->disposePerContextData();
76 80
77 // It's likely that disposing the context has created a lot of 81 // It's likely that disposing the context has created a lot of
78 // garbage. Notify V8 about this so it'll have a chance of cleaning 82 // garbage. Notify V8 about this so it'll have a chance of cleaning
79 // it up when idle. 83 // it up when idle.
80 V8GCForContextDispose::instance().notifyContextDisposed( 84 V8GCForContextDispose::instance().notifyContextDisposed(
81 frame()->isMainFrame()); 85 frame()->isMainFrame());
82 86
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 v8::Local<v8::Context> context = m_scriptState->context(); 147 v8::Local<v8::Context> context = m_scriptState->context();
144 148
145 // The global proxy object. Note this is not the global object. 149 // The global proxy object. Note this is not the global object.
146 v8::Local<v8::Object> globalProxy = context->Global(); 150 v8::Local<v8::Object> globalProxy = context->Global();
147 CHECK(m_globalProxy == globalProxy); 151 CHECK(m_globalProxy == globalProxy);
148 V8DOMWrapper::setNativeInfo(isolate(), globalProxy, wrapperTypeInfo, window); 152 V8DOMWrapper::setNativeInfo(isolate(), globalProxy, wrapperTypeInfo, window);
149 // Mark the handle to be traced by Oilpan, since the global proxy has a 153 // Mark the handle to be traced by Oilpan, since the global proxy has a
150 // reference to the DOMWindow. 154 // reference to the DOMWindow.
151 m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId); 155 m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId);
152 156
157 #if DCHECK_IS_ON()
158 didAttachGlobalProxy();
159 #endif
160
153 // The global object, aka window wrapper object. 161 // The global object, aka window wrapper object.
154 v8::Local<v8::Object> windowWrapper = 162 v8::Local<v8::Object> windowWrapper =
155 globalProxy->GetPrototype().As<v8::Object>(); 163 globalProxy->GetPrototype().As<v8::Object>();
156 windowWrapper = V8DOMWrapper::associateObjectWithWrapper( 164 windowWrapper = V8DOMWrapper::associateObjectWithWrapper(
157 isolate(), window, wrapperTypeInfo, windowWrapper); 165 isolate(), window, wrapperTypeInfo, windowWrapper);
158 166
159 // The prototype object of Window interface. 167 // The prototype object of Window interface.
160 v8::Local<v8::Object> windowPrototype = 168 v8::Local<v8::Object> windowPrototype =
161 windowWrapper->GetPrototype().As<v8::Object>(); 169 windowWrapper->GetPrototype().As<v8::Object>();
162 CHECK(!windowPrototype.IsEmpty()); 170 CHECK(!windowPrototype.IsEmpty());
163 V8DOMWrapper::setNativeInfo(isolate(), windowPrototype, wrapperTypeInfo, 171 V8DOMWrapper::setNativeInfo(isolate(), windowPrototype, wrapperTypeInfo,
164 window); 172 window);
165 173
166 // The named properties object of Window interface. 174 // The named properties object of Window interface.
167 v8::Local<v8::Object> windowProperties = 175 v8::Local<v8::Object> windowProperties =
168 windowPrototype->GetPrototype().As<v8::Object>(); 176 windowPrototype->GetPrototype().As<v8::Object>();
169 CHECK(!windowProperties.IsEmpty()); 177 CHECK(!windowProperties.IsEmpty());
170 V8DOMWrapper::setNativeInfo(isolate(), windowProperties, wrapperTypeInfo, 178 V8DOMWrapper::setNativeInfo(isolate(), windowProperties, wrapperTypeInfo,
171 window); 179 window);
172 } 180 }
173 181
174 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698