| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Dispose of the underlying V8 object before releasing our reference | 116 // Dispose of the underlying V8 object before releasing our reference |
| 117 // to it, so that if a plugin fails to release it properly we will | 117 // to it, so that if a plugin fails to release it properly we will |
| 118 // only leak the NPObject wrapper, not the object, its document, or | 118 // only leak the NPObject wrapper, not the object, its document, or |
| 119 // anything else they reference. | 119 // anything else they reference. |
| 120 disposeUnderlyingV8Object(m_windowScriptNPObject, m_isolate); | 120 disposeUnderlyingV8Object(m_windowScriptNPObject, m_isolate); |
| 121 _NPN_ReleaseObject(m_windowScriptNPObject); | 121 _NPN_ReleaseObject(m_windowScriptNPObject); |
| 122 m_windowScriptNPObject = 0; | 122 m_windowScriptNPObject = 0; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ScriptController::clearForOutOfMemory() | |
| 127 { | |
| 128 clearForClose(true); | |
| 129 } | |
| 130 | |
| 131 void ScriptController::clearForClose(bool destroyGlobal) | |
| 132 { | |
| 133 m_windowShell->clearForClose(destroyGlobal); | |
| 134 for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin(); iter != m_i
solatedWorlds.end(); ++iter) | |
| 135 iter->value->clearForClose(destroyGlobal); | |
| 136 } | |
| 137 | |
| 138 void ScriptController::clearForClose() | 126 void ScriptController::clearForClose() |
| 139 { | 127 { |
| 140 double start = currentTime(); | 128 double start = currentTime(); |
| 141 clearForClose(false); | 129 m_windowShell->clearForClose(); |
| 130 for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin(); iter != m_i
solatedWorlds.end(); ++iter) |
| 131 iter->value->clearForClose(); |
| 142 blink::Platform::current()->histogramCustomCounts("WebCore.ScriptController.
clearForClose", (currentTime() - start) * 1000, 0, 10000, 50); | 132 blink::Platform::current()->histogramCustomCounts("WebCore.ScriptController.
clearForClose", (currentTime() - start) * 1000, 0, 10000, 50); |
| 143 } | 133 } |
| 144 | 134 |
| 145 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) | 135 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) |
| 146 { | 136 { |
| 147 m_windowShell->updateSecurityOrigin(origin); | 137 m_windowShell->updateSecurityOrigin(origin); |
| 148 } | 138 } |
| 149 | 139 |
| 150 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) | 140 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) |
| 151 { | 141 { |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 v8Results = evaluateHandleScope.Escape(resultArray); | 640 v8Results = evaluateHandleScope.Escape(resultArray); |
| 651 } | 641 } |
| 652 | 642 |
| 653 if (results && !v8Results.IsEmpty()) { | 643 if (results && !v8Results.IsEmpty()) { |
| 654 for (size_t i = 0; i < v8Results->Length(); ++i) | 644 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 655 results->append(ScriptValue(v8Results->Get(i), m_isolate)); | 645 results->append(ScriptValue(v8Results->Get(i), m_isolate)); |
| 656 } | 646 } |
| 657 } | 647 } |
| 658 | 648 |
| 659 } // namespace WebCore | 649 } // namespace WebCore |
| OLD | NEW |