| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/worker/worker_thread.h" | 5 #include "chrome/worker/worker_thread.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/thread_local.h" | 8 #include "base/thread_local.h" |
| 9 #include "chrome/common/worker_messages.h" | 9 #include "chrome/common/worker_messages.h" |
| 10 #include "chrome/worker/webworker_stub.h" | 10 #include "chrome/worker/webworker_stub.h" |
| 11 #include "chrome/worker/websharedworker_stub.h" | 11 #include "chrome/worker/websharedworker_stub.h" |
| 12 #include "chrome/worker/worker_webkitclient_impl.h" | 12 #include "chrome/worker/worker_webkitclient_impl.h" |
| 13 #include "webkit/api/public/WebKit.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 14 | 14 |
| 15 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls( | 15 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls( |
| 16 base::LINKER_INITIALIZED); | 16 base::LINKER_INITIALIZED); |
| 17 | 17 |
| 18 | 18 |
| 19 WorkerThread::WorkerThread() { | 19 WorkerThread::WorkerThread() { |
| 20 lazy_tls.Pointer()->Set(this); | 20 lazy_tls.Pointer()->Set(this); |
| 21 webkit_client_.reset(new WorkerWebKitClientImpl); | 21 webkit_client_.reset(new WorkerWebKitClientImpl); |
| 22 WebKit::initialize(webkit_client_.get()); | 22 WebKit::initialize(webkit_client_.get()); |
| 23 } | 23 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 void WorkerThread::OnCreateWorker(const GURL& url, | 41 void WorkerThread::OnCreateWorker(const GURL& url, |
| 42 bool is_shared, | 42 bool is_shared, |
| 43 const string16& name, | 43 const string16& name, |
| 44 int route_id) { | 44 int route_id) { |
| 45 // WebWorkerStub and WebSharedWorkerStub own themselves. | 45 // WebWorkerStub and WebSharedWorkerStub own themselves. |
| 46 if (is_shared) | 46 if (is_shared) |
| 47 new WebSharedWorkerStub(name, route_id); | 47 new WebSharedWorkerStub(name, route_id); |
| 48 else | 48 else |
| 49 new WebWorkerStub(url, route_id); | 49 new WebWorkerStub(url, route_id); |
| 50 } | 50 } |
| OLD | NEW |