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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; | 141 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; |
142 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) | 142 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) |
143 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; | 143 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; |
144 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); | 144 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); |
145 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); | 145 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); |
146 if (jsWorkerGlobalScope.IsEmpty()) { | 146 if (jsWorkerGlobalScope.IsEmpty()) { |
147 disposeContext(); | 147 disposeContext(); |
148 return false; | 148 return false; |
149 } | 149 } |
150 | 150 |
151 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor
kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolat
e, WrapperConfiguration::Dependent); | 151 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtrWill
BeRawPtr<WorkerGlobalScope>(&m_workerGlobalScope), contextType, jsWorkerGlobalSc
ope, m_isolate, WrapperConfiguration::Dependent); |
152 | 152 |
153 // Insert the object instance as the prototype of the shadow object. | 153 // Insert the object instance as the prototype of the shadow object. |
154 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_perCont
extData->context()->Global()->GetPrototype()); | 154 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_perCont
extData->context()->Global()->GetPrototype()); |
155 globalObject->SetPrototype(jsWorkerGlobalScope); | 155 globalObject->SetPrototype(jsWorkerGlobalScope); |
156 | 156 |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 ScriptValue WorkerScriptController::evaluate(const String& script, const String&
fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt
ate* state) | 160 ScriptValue WorkerScriptController::evaluate(const String& script, const String&
fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt
ate* state) |
161 { | 161 { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 273 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
274 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); | 274 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); |
275 // Return 0 if the current executing context is not the worker context. | 275 // Return 0 if the current executing context is not the worker context. |
276 if (global.IsEmpty()) | 276 if (global.IsEmpty()) |
277 return 0; | 277 return 0; |
278 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; | 278 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; |
279 return workerGlobalScope->script(); | 279 return workerGlobalScope->script(); |
280 } | 280 } |
281 | 281 |
282 } // namespace WebCore | 282 } // namespace WebCore |
OLD | NEW |