| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; | 154 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; |
| 155 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) | 155 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) |
| 156 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; | 156 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; |
| 157 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); | 157 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co
nstructorForType(contextType); |
| 158 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); | 158 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance
(workerGlobalScopeConstructor); |
| 159 if (jsWorkerGlobalScope.IsEmpty()) { | 159 if (jsWorkerGlobalScope.IsEmpty()) { |
| 160 disposeContext(); | 160 disposeContext(); |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor
kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, isolate(
), WrapperConfiguration::Dependent); | 164 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtrWill
BeRawPtr<WorkerGlobalScope>(&m_workerGlobalScope), contextType, jsWorkerGlobalSc
ope, isolate(), WrapperConfiguration::Dependent); |
| 165 | 165 |
| 166 // Insert the object instance as the prototype of the shadow object. | 166 // Insert the object instance as the prototype of the shadow object. |
| 167 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context
Holder->context()->Global()->GetPrototype()); | 167 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context
Holder->context()->Global()->GetPrototype()); |
| 168 globalObject->SetPrototype(jsWorkerGlobalScope); | 168 globalObject->SetPrototype(jsWorkerGlobalScope); |
| 169 | 169 |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 | 172 |
| 173 ScriptValue WorkerScriptController::evaluate(const String& script, const String&
fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt
ate* state) | 173 ScriptValue WorkerScriptController::evaluate(const String& script, const String&
fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt
ate* state) |
| 174 { | 174 { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 286 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
| 287 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); | 287 v8::Handle<v8::Object> global = V8WorkerGlobalScope::findInstanceInPrototype
Chain(context->Global(), isolate); |
| 288 // Return 0 if the current executing context is not the worker context. | 288 // Return 0 if the current executing context is not the worker context. |
| 289 if (global.IsEmpty()) | 289 if (global.IsEmpty()) |
| 290 return 0; | 290 return 0; |
| 291 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; | 291 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; |
| 292 return workerGlobalScope->script(); | 292 return workerGlobalScope->script(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace WebCore | 295 } // namespace WebCore |
| OLD | NEW |