| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 { | 71 { |
| 72 } | 72 } |
| 73 | 73 |
| 74 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) | 74 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) |
| 75 { | 75 { |
| 76 if (!isContextInitialized()) | 76 if (!isContextInitialized()) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 v8::HandleScope handleScope(m_isolate); | 79 v8::HandleScope handleScope(m_isolate); |
| 80 v8::Handle<v8::Context> context = m_scriptState->context(); | 80 v8::Handle<v8::Context> context = m_scriptState->context(); |
| 81 m_frame->loaderClient()->willReleaseScriptContext(context, m_world->worldId(
)); | 81 m_frame->loaderClient()->willReleaseScriptContext(context); |
| 82 | 82 |
| 83 if (behavior == DetachGlobal) | 83 if (behavior == DetachGlobal) |
| 84 context->DetachGlobal(); | 84 context->DetachGlobal(); |
| 85 | 85 |
| 86 m_scriptState->disposePerContextData(); | 86 m_scriptState->disposePerContextData(); |
| 87 | 87 |
| 88 // It's likely that disposing the context has created a lot of | 88 // It's likely that disposing the context has created a lot of |
| 89 // garbage. Notify V8 about this so it'll have a chance of cleaning | 89 // garbage. Notify V8 about this so it'll have a chance of cleaning |
| 90 // it up when idle. | 90 // it up when idle. |
| 91 V8GCForContextDispose::instanceTemplate().notifyContextDisposed(); | 91 V8GCForContextDispose::instanceTemplate().notifyContextDisposed(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return false; | 189 return false; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 if (!installDOMWindow()) { | 193 if (!installDOMWindow()) { |
| 194 disposeContext(DoNotDetachGlobal); | 194 disposeContext(DoNotDetachGlobal); |
| 195 return false; | 195 return false; |
| 196 } | 196 } |
| 197 | 197 |
| 198 updateDocument(); | 198 updateDocument(); |
| 199 m_frame->loaderClient()->didCreateScriptContext(context, m_world->extensionG
roup(), m_world->worldId()); | 199 m_frame->loaderClient()->didCreateScriptContext(context); |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void WindowProxy::createContext() | 203 void WindowProxy::createContext() |
| 204 { | 204 { |
| 205 // Create a new environment using an empty template for the shadow | 205 // Create a new environment using an empty template for the shadow |
| 206 // object. Reuse the global object if one has been created earlier. | 206 // object. Reuse the global object if one has been created earlier. |
| 207 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::getShadowObjectTem
plate(m_isolate); | 207 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::getShadowObjectTem
plate(m_isolate); |
| 208 if (globalTemplate.IsEmpty()) | 208 if (globalTemplate.IsEmpty()) |
| 209 return; | 209 return; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 { | 316 { |
| 317 ASSERT(m_world->isMainWorld()); | 317 ASSERT(m_world->isMainWorld()); |
| 318 if (!isGlobalInitialized()) | 318 if (!isGlobalInitialized()) |
| 319 return; | 319 return; |
| 320 if (!isContextInitialized()) | 320 if (!isContextInitialized()) |
| 321 return; | 321 return; |
| 322 updateDocumentProperty(); | 322 updateDocumentProperty(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |