| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 WindowProxy::WindowProxy(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Is
olate* isolate) | 85 WindowProxy::WindowProxy(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Is
olate* isolate) |
| 86 : m_frame(frame) | 86 : m_frame(frame) |
| 87 , m_isolate(isolate) | 87 , m_isolate(isolate) |
| 88 , m_world(world) | 88 , m_world(world) |
| 89 { | 89 { |
| 90 } | 90 } |
| 91 | 91 |
| 92 WindowProxy::~WindowProxy() | 92 WindowProxy::~WindowProxy() |
| 93 { | 93 { |
| 94 // clearForClose() or clearForNavigation() must be invoked before destructio
n starts. | 94 // clearWindowProxy() must be invoked before destruction starts. |
| 95 ASSERT(!isContextInitialized()); | 95 ASSERT(!isContextInitialized()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 DEFINE_TRACE(WindowProxy) | 98 DEFINE_TRACE(WindowProxy) |
| 99 { | 99 { |
| 100 visitor->trace(m_frame); | 100 visitor->trace(m_frame); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) | 103 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) |
| 104 { | 104 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 120 m_scriptState->detachGlobalObject(); | 120 m_scriptState->detachGlobalObject(); |
| 121 | 121 |
| 122 m_scriptState->disposePerContextData(); | 122 m_scriptState->disposePerContextData(); |
| 123 | 123 |
| 124 // It's likely that disposing the context has created a lot of | 124 // It's likely that disposing the context has created a lot of |
| 125 // garbage. Notify V8 about this so it'll have a chance of cleaning | 125 // garbage. Notify V8 about this so it'll have a chance of cleaning |
| 126 // it up when idle. | 126 // it up when idle. |
| 127 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame
()); | 127 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame
()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void WindowProxy::clearForClose() | 130 void WindowProxy::clearWindowProxy() |
| 131 { | 131 { |
| 132 if (!isContextInitialized()) | 132 if (!isContextInitialized()) |
| 133 return; | 133 return; |
| 134 | |
| 135 disposeContext(DoNotDetachGlobal); | |
| 136 } | |
| 137 | |
| 138 void WindowProxy::clearForNavigation() | |
| 139 { | |
| 140 if (!isContextInitialized()) | |
| 141 return; | |
| 142 | 134 |
| 143 ScriptState::Scope scope(m_scriptState.get()); | 135 ScriptState::Scope scope(m_scriptState.get()); |
| 144 | 136 |
| 145 disposeContext(DetachGlobal); | 137 disposeContext(DetachGlobal); |
| 146 } | 138 } |
| 147 | 139 |
| 148 v8::Local<v8::Object> WindowProxy::releaseGlobal() | 140 v8::Local<v8::Object> WindowProxy::releaseGlobal() |
| 149 { | 141 { |
| 150 ASSERT(!isContextInitialized()); | 142 ASSERT(!isContextInitialized()); |
| 151 // If a ScriptState was created, the context was initialized at some point. | 143 // If a ScriptState was created, the context was initialized at some point. |
| 152 // Make sure the global object was detached from the proxy by calling clearF
orNavigation(). | 144 // Make sure the global object was detached from the proxy by calling clearW
indowProxy(). |
| 153 if (m_scriptState) | 145 if (m_scriptState) |
| 154 ASSERT(m_scriptState->isGlobalObjectDetached()); | 146 ASSERT(m_scriptState->isGlobalObjectDetached()); |
| 155 v8::Local<v8::Object> global = m_global.newLocal(m_isolate); | 147 v8::Local<v8::Object> global = m_global.newLocal(m_isolate); |
| 156 m_global.clear(); | 148 m_global.clear(); |
| 157 return global; | 149 return global; |
| 158 } | 150 } |
| 159 | 151 |
| 160 void WindowProxy::setGlobal(v8::Local<v8::Object> global) | 152 void WindowProxy::setGlobal(v8::Local<v8::Object> global) |
| 161 { | 153 { |
| 162 m_global.set(m_isolate, global); | 154 m_global.set(m_isolate, global); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 562 } |
| 571 | 563 |
| 572 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 564 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
| 573 { | 565 { |
| 574 if (!isContextInitialized()) | 566 if (!isContextInitialized()) |
| 575 return; | 567 return; |
| 576 setSecurityToken(origin); | 568 setSecurityToken(origin); |
| 577 } | 569 } |
| 578 | 570 |
| 579 } // namespace blink | 571 } // namespace blink |
| OLD | NEW |