| OLD | NEW |
| 1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
| 2 // All rights reserved. | 2 // 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 27 matching lines...) Expand all Loading... |
| 38 #include "v8_proxy.h" | 38 #include "v8_proxy.h" |
| 39 #include "v8_binding.h" | 39 #include "v8_binding.h" |
| 40 #include "V8Collection.h" | 40 #include "V8Collection.h" |
| 41 #include "V8DOMWindow.h" | 41 #include "V8DOMWindow.h" |
| 42 #include "V8IsolatedWorld.h" | 42 #include "V8IsolatedWorld.h" |
| 43 | 43 |
| 44 #include "ChromiumBridge.h" | 44 #include "ChromiumBridge.h" |
| 45 #include "CSSMutableStyleDeclaration.h" | 45 #include "CSSMutableStyleDeclaration.h" |
| 46 #include "DOMObjectsInclude.h" | 46 #include "DOMObjectsInclude.h" |
| 47 #include "DocumentLoader.h" | 47 #include "DocumentLoader.h" |
| 48 #include "FrameLoaderClient.h" |
| 48 #include "ScriptController.h" | 49 #include "ScriptController.h" |
| 49 #include "V8CustomBinding.h" | 50 #include "V8CustomBinding.h" |
| 50 #include "V8DOMMap.h" | 51 #include "V8DOMMap.h" |
| 51 #include "V8Index.h" | 52 #include "V8Index.h" |
| 52 #include "WorkerContextExecutionProxy.h" | 53 #include "WorkerContextExecutionProxy.h" |
| 53 | 54 |
| 54 namespace WebCore { | 55 namespace WebCore { |
| 55 | 56 |
| 56 // Static utility context. | 57 // Static utility context. |
| 57 v8::Persistent<v8::Context> V8Proxy::m_utilityContext; | 58 v8::Persistent<v8::Context> V8Proxy::m_utilityContext; |
| (...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 | 1925 |
| 1925 void V8Proxy::ClearDocumentWrapperCache() | 1926 void V8Proxy::ClearDocumentWrapperCache() |
| 1926 { | 1927 { |
| 1927 ASSERT(!m_context.IsEmpty()); | 1928 ASSERT(!m_context.IsEmpty()); |
| 1928 m_context->Global()->ForceDelete(v8::String::New("document")); | 1929 m_context->Global()->ForceDelete(v8::String::New("document")); |
| 1929 } | 1930 } |
| 1930 | 1931 |
| 1931 | 1932 |
| 1932 void V8Proxy::DisposeContextHandles() { | 1933 void V8Proxy::DisposeContextHandles() { |
| 1933 if (!m_context.IsEmpty()) { | 1934 if (!m_context.IsEmpty()) { |
| 1935 m_frame->loader()->client()->didDestroyScriptContext(); |
| 1934 m_context.Dispose(); | 1936 m_context.Dispose(); |
| 1935 m_context.Clear(); | 1937 m_context.Clear(); |
| 1936 } | 1938 } |
| 1937 | 1939 |
| 1938 if (!m_wrapper_boilerplates.IsEmpty()) { | 1940 if (!m_wrapper_boilerplates.IsEmpty()) { |
| 1939 #ifndef NDEBUG | 1941 #ifndef NDEBUG |
| 1940 UnregisterGlobalHandle(this, m_wrapper_boilerplates); | 1942 UnregisterGlobalHandle(this, m_wrapper_boilerplates); |
| 1941 #endif | 1943 #endif |
| 1942 m_wrapper_boilerplates.Dispose(); | 1944 m_wrapper_boilerplates.Dispose(); |
| 1943 m_wrapper_boilerplates.Clear(); | 1945 m_wrapper_boilerplates.Clear(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 RegisterGlobalHandle(PROXY, this, m_wrapper_boilerplates); | 2329 RegisterGlobalHandle(PROXY, this, m_wrapper_boilerplates); |
| 2328 #endif | 2330 #endif |
| 2329 | 2331 |
| 2330 if (!installDOMWindow(context, m_frame->domWindow())) | 2332 if (!installDOMWindow(context, m_frame->domWindow())) |
| 2331 DisposeContextHandles(); | 2333 DisposeContextHandles(); |
| 2332 | 2334 |
| 2333 updateDocument(); | 2335 updateDocument(); |
| 2334 | 2336 |
| 2335 SetSecurityToken(); | 2337 SetSecurityToken(); |
| 2336 | 2338 |
| 2339 m_frame->loader()->client()->didCreateScriptContext(); |
| 2337 m_frame->loader()->dispatchWindowObjectAvailable(); | 2340 m_frame->loader()->dispatchWindowObjectAvailable(); |
| 2338 } | 2341 } |
| 2339 | 2342 |
| 2340 template <class T> | 2343 template <class T> |
| 2341 void setDOMExceptionHelper(V8ClassIndex::V8WrapperType type, PassRefPtr<T> excep
tion) { | 2344 void setDOMExceptionHelper(V8ClassIndex::V8WrapperType type, PassRefPtr<T> excep
tion) { |
| 2342 v8::Handle<v8::Value> v8Exception; | 2345 v8::Handle<v8::Value> v8Exception; |
| 2343 if (WorkerContextExecutionProxy::retrieve()) | 2346 if (WorkerContextExecutionProxy::retrieve()) |
| 2344 v8Exception = WorkerContextExecutionProxy::ToV8Object(type, exception.get(
)); | 2347 v8Exception = WorkerContextExecutionProxy::ToV8Object(type, exception.get(
)); |
| 2345 else | 2348 else |
| 2346 v8Exception = V8Proxy::ToV8Object(type, exception.get()); | 2349 v8Exception = V8Proxy::ToV8Object(type, exception.get()); |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3557 v8::HandleScope scope; | 3560 v8::HandleScope scope; |
| 3558 if (!context->GetData()->IsObject()) { | 3561 if (!context->GetData()->IsObject()) { |
| 3559 return -1; | 3562 return -1; |
| 3560 } | 3563 } |
| 3561 v8::Handle<v8::Value> data = context->GetData()->ToObject()->Get( | 3564 v8::Handle<v8::Value> data = context->GetData()->ToObject()->Get( |
| 3562 v8::String::New(kContextDebugDataValue)); | 3565 v8::String::New(kContextDebugDataValue)); |
| 3563 return data->IsInt32() ? data->Int32Value() : -1; | 3566 return data->IsInt32() ? data->Int32Value() : -1; |
| 3564 } | 3567 } |
| 3565 | 3568 |
| 3566 } // namespace WebCore | 3569 } // namespace WebCore |
| OLD | NEW |