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

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: GlobalProxy -> GlobalObject 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 didDetachGlobalObject();
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 123
120 v8::Local<v8::Context> context; 124 v8::Local<v8::Context> context;
121 { 125 {
122 V8PerIsolateData::UseCounterDisabledScope useCounterDisabled( 126 V8PerIsolateData::UseCounterDisabledScope useCounterDisabled(
123 V8PerIsolateData::from(isolate())); 127 V8PerIsolateData::from(isolate()));
124 context = v8::Context::New(isolate(), nullptr, globalTemplate, 128 context = v8::Context::New(isolate(), nullptr, globalTemplate,
125 m_globalProxy.newLocal(isolate())); 129 m_globalProxy.newLocal(isolate()));
126 } 130 }
127 CHECK(!context.IsEmpty()); 131 CHECK(!context.IsEmpty());
128 132
133 #if DCHECK_IS_ON()
134 didAttachGlobalObject();
135 #endif
136
129 m_scriptState = ScriptState::create(context, m_world); 137 m_scriptState = ScriptState::create(context, m_world);
130 138
131 // TODO(haraken): Currently we cannot enable the following DCHECK because 139 // TODO(haraken): Currently we cannot enable the following DCHECK because
132 // an already detached window proxy can be re-initialized. This is wrong. 140 // an already detached window proxy can be re-initialized. This is wrong.
133 // DCHECK(m_lifecycle == Lifecycle::ContextUninitialized); 141 // DCHECK(m_lifecycle == Lifecycle::ContextUninitialized);
134 m_lifecycle = Lifecycle::ContextInitialized; 142 m_lifecycle = Lifecycle::ContextInitialized;
135 DCHECK(m_scriptState->contextIsValid()); 143 DCHECK(m_scriptState->contextIsValid());
136 } 144 }
137 145
138 void RemoteWindowProxy::setupWindowPrototypeChain() { 146 void RemoteWindowProxy::setupWindowPrototypeChain() {
(...skipping 26 matching lines...) Expand all
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