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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope) | 61 WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
ope) |
62 : m_isolate(v8::Isolate::New()) | 62 : m_isolate(v8::Isolate::New()) |
63 , m_workerGlobalScope(workerGlobalScope) | 63 , m_workerGlobalScope(workerGlobalScope) |
64 , m_executionForbidden(false) | 64 , m_executionForbidden(false) |
65 , m_executionScheduledToTerminate(false) | 65 , m_executionScheduledToTerminate(false) |
66 { | 66 { |
67 m_isolate->Enter(); | 67 m_isolate->Enter(); |
68 V8Initializer::initializeWorker(m_isolate); | 68 V8Initializer::initializeWorker(m_isolate); |
69 v8::V8::Initialize(); | 69 v8::V8::Initialize(); |
70 V8PerIsolateData::ensureInitialized(m_isolate); | 70 V8PerIsolateData::ensureInitialized(m_isolate); |
71 m_world = DOMWrapperWorld::create(WorkerWorldId); | 71 m_world = DOMWrapperWorld::create(WorkerWorldId, -1); |
72 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); | 72 m_interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); |
73 ThreadState::current()->addInterruptor(m_interruptor.get()); | 73 ThreadState::current()->addInterruptor(m_interruptor.get()); |
74 } | 74 } |
75 | 75 |
76 // We need to postpone V8 Isolate destruction until the very end of | 76 // We need to postpone V8 Isolate destruction until the very end of |
77 // worker thread finalization when all objects on the worker heap | 77 // worker thread finalization when all objects on the worker heap |
78 // are destroyed. | 78 // are destroyed. |
79 class IsolateCleanupTask : public ThreadState::CleanupTask { | 79 class IsolateCleanupTask : public ThreadState::CleanupTask { |
80 public: | 80 public: |
81 static PassOwnPtr<IsolateCleanupTask> create(v8::Isolate* isolate) | 81 static PassOwnPtr<IsolateCleanupTask> create(v8::Isolate* isolate) |
(...skipping 191 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 |