OLD | NEW |
---|---|
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56). | 85 // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56). |
86 // We need to figure out why m_globalProxy != context->Global(). | 86 // We need to figure out why m_globalProxy != context->Global(). |
87 DCHECK(m_globalProxy == context->Global()); | 87 DCHECK(m_globalProxy == context->Global()); |
88 DCHECK_EQ(toScriptWrappable(context->Global()), | 88 DCHECK_EQ(toScriptWrappable(context->Global()), |
89 toScriptWrappable( | 89 toScriptWrappable( |
90 context->Global()->GetPrototype().As<v8::Object>())); | 90 context->Global()->GetPrototype().As<v8::Object>())); |
91 m_globalProxy.get().SetWrapperClassId(0); | 91 m_globalProxy.get().SetWrapperClassId(0); |
92 } | 92 } |
93 V8DOMWrapper::clearNativeInfo(isolate(), context->Global()); | 93 V8DOMWrapper::clearNativeInfo(isolate(), context->Global()); |
94 m_scriptState->detachGlobalObject(); | 94 m_scriptState->detachGlobalObject(); |
95 | |
96 #if DCHECK_IS_ON() | |
97 didDetachGlobalProxy(); | |
Yuki
2017/03/09 07:15:17
nit: Is this name appropriate?
The old implementa
dcheng
2017/03/09 07:19:56
Hmm... so what we want to track here is that the f
Yuki
2017/03/09 07:26:31
A global object of V8 must be tightly bound to a D
dcheng
2017/03/09 08:00:52
Remote contexts have an inner global object, so th
| |
98 #endif | |
95 } | 99 } |
96 | 100 |
97 m_scriptState->disposePerContextData(); | 101 m_scriptState->disposePerContextData(); |
98 | 102 |
99 // It's likely that disposing the context has created a lot of | 103 // It's likely that disposing the context has created a lot of |
100 // garbage. Notify V8 about this so it'll have a chance of cleaning | 104 // garbage. Notify V8 about this so it'll have a chance of cleaning |
101 // it up when idle. | 105 // it up when idle. |
102 V8GCForContextDispose::instance().notifyContextDisposed( | 106 V8GCForContextDispose::instance().notifyContextDisposed( |
103 frame()->isMainFrame()); | 107 frame()->isMainFrame()); |
104 | 108 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 v8::Local<v8::Context> context = m_scriptState->context(); | 208 v8::Local<v8::Context> context = m_scriptState->context(); |
205 | 209 |
206 // The global proxy object. Note this is not the global object. | 210 // The global proxy object. Note this is not the global object. |
207 v8::Local<v8::Object> globalProxy = context->Global(); | 211 v8::Local<v8::Object> globalProxy = context->Global(); |
208 CHECK(m_globalProxy == globalProxy); | 212 CHECK(m_globalProxy == globalProxy); |
209 V8DOMWrapper::setNativeInfo(isolate(), globalProxy, wrapperTypeInfo, window); | 213 V8DOMWrapper::setNativeInfo(isolate(), globalProxy, wrapperTypeInfo, window); |
210 // Mark the handle to be traced by Oilpan, since the global proxy has a | 214 // Mark the handle to be traced by Oilpan, since the global proxy has a |
211 // reference to the DOMWindow. | 215 // reference to the DOMWindow. |
212 m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId); | 216 m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId); |
213 | 217 |
218 #if DCHECK_IS_ON() | |
219 didAttachGlobalProxy(); | |
220 #endif | |
221 | |
214 // The global object, aka window wrapper object. | 222 // The global object, aka window wrapper object. |
215 v8::Local<v8::Object> windowWrapper = | 223 v8::Local<v8::Object> windowWrapper = |
216 globalProxy->GetPrototype().As<v8::Object>(); | 224 globalProxy->GetPrototype().As<v8::Object>(); |
217 windowWrapper = V8DOMWrapper::associateObjectWithWrapper( | 225 windowWrapper = V8DOMWrapper::associateObjectWithWrapper( |
218 isolate(), window, wrapperTypeInfo, windowWrapper); | 226 isolate(), window, wrapperTypeInfo, windowWrapper); |
219 | 227 |
220 // The prototype object of Window interface. | 228 // The prototype object of Window interface. |
221 v8::Local<v8::Object> windowPrototype = | 229 v8::Local<v8::Object> windowPrototype = |
222 windowWrapper->GetPrototype().As<v8::Object>(); | 230 windowWrapper->GetPrototype().As<v8::Object>(); |
223 CHECK(!windowPrototype.IsEmpty()); | 231 CHECK(!windowPrototype.IsEmpty()); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 | 439 |
432 setSecurityToken(origin); | 440 setSecurityToken(origin); |
433 } | 441 } |
434 | 442 |
435 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, | 443 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, |
436 LocalFrame& frame, | 444 LocalFrame& frame, |
437 RefPtr<DOMWrapperWorld> world) | 445 RefPtr<DOMWrapperWorld> world) |
438 : WindowProxy(isolate, frame, std::move(world)) {} | 446 : WindowProxy(isolate, frame, std::move(world)) {} |
439 | 447 |
440 } // namespace blink | 448 } // namespace blink |
OLD | NEW |