| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 m_perContextData = V8PerContextData::create(context); | 108 m_perContextData = V8PerContextData::create(context); |
| 109 if (!m_perContextData->init()) { | 109 if (!m_perContextData->init()) { |
| 110 disposeContext(); | 110 disposeContext(); |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Set DebugId for the new context. | 114 // Set DebugId for the new context. |
| 115 context->SetEmbedderData(0, v8::String::NewSymbol("worker")); | 115 context->SetEmbedderData(0, v8::String::NewSymbol("worker")); |
| 116 | 116 |
| 117 // Create a new JS object and use it as the prototype for the shadow global
object. | 117 // Create a new JS object and use it as the prototype for the shadow global
object. |
| 118 WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::wrapperTypeInf
o; | 118 const WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::wrapperT
ypeInfo; |
| 119 if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) | 119 if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) |
| 120 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; | 120 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; |
| 121 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); | 121 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); |
| 122 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); | 122 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); |
| 123 if (jsWorkerGlobalScope.IsEmpty()) { | 123 if (jsWorkerGlobalScope.IsEmpty()) { |
| 124 disposeContext(); | 124 disposeContext(); |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor
kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolat
e, WrapperConfiguration::Dependent); | 128 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor
kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolat
e, WrapperConfiguration::Dependent); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 v8::Handle<v8::Object> global = context->Global(); | 250 v8::Handle<v8::Object> global = context->Global(); |
| 251 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla
te(context->GetIsolate(), WorkerWorld)); | 251 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla
te(context->GetIsolate(), WorkerWorld)); |
| 252 // Return 0 if the current executing context is not the worker context. | 252 // Return 0 if the current executing context is not the worker context. |
| 253 if (global.IsEmpty()) | 253 if (global.IsEmpty()) |
| 254 return 0; | 254 return 0; |
| 255 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; | 255 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; |
| 256 return workerGlobalScope->script(); | 256 return workerGlobalScope->script(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace WebCore | 259 } // namespace WebCore |
| OLD | NEW |