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 didDetachGlobalObject(); |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 v8::Local<v8::Context> context; | 184 v8::Local<v8::Context> context; |
181 { | 185 { |
182 V8PerIsolateData::UseCounterDisabledScope useCounterDisabled( | 186 V8PerIsolateData::UseCounterDisabledScope useCounterDisabled( |
183 V8PerIsolateData::from(isolate())); | 187 V8PerIsolateData::from(isolate())); |
184 context = | 188 context = |
185 v8::Context::New(isolate(), &extensionConfiguration, globalTemplate, | 189 v8::Context::New(isolate(), &extensionConfiguration, globalTemplate, |
186 m_globalProxy.newLocal(isolate())); | 190 m_globalProxy.newLocal(isolate())); |
187 } | 191 } |
188 CHECK(!context.IsEmpty()); | 192 CHECK(!context.IsEmpty()); |
189 | 193 |
| 194 #if DCHECK_IS_ON() |
| 195 didAttachGlobalObject(); |
| 196 #endif |
| 197 |
190 m_scriptState = ScriptState::create(context, m_world); | 198 m_scriptState = ScriptState::create(context, m_world); |
191 | 199 |
192 // TODO(haraken): Currently we cannot enable the following DCHECK because | 200 // TODO(haraken): Currently we cannot enable the following DCHECK because |
193 // an already detached window proxy can be re-initialized. This is wrong. | 201 // an already detached window proxy can be re-initialized. This is wrong. |
194 // DCHECK(m_lifecycle == Lifecycle::ContextUninitialized); | 202 // DCHECK(m_lifecycle == Lifecycle::ContextUninitialized); |
195 m_lifecycle = Lifecycle::ContextInitialized; | 203 m_lifecycle = Lifecycle::ContextInitialized; |
196 DCHECK(m_scriptState->contextIsValid()); | 204 DCHECK(m_scriptState->contextIsValid()); |
197 } | 205 } |
198 | 206 |
199 void LocalWindowProxy::setupWindowPrototypeChain() { | 207 void LocalWindowProxy::setupWindowPrototypeChain() { |
(...skipping 231 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 |