| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/worker/worker_thread.h" | 5 #include "content/worker/worker_thread.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/thread_local.h" | 9 #include "base/threading/thread_local.h" |
| 10 #include "content/child/appcache_dispatcher.h" | 10 #include "content/child/appcache_dispatcher.h" |
| 11 #include "content/child/db_message_filter.h" | 11 #include "content/child/db_message_filter.h" |
| 12 #include "content/child/indexed_db/indexed_db_message_filter.h" | 12 #include "content/child/indexed_db/indexed_db_message_filter.h" |
| 13 #include "content/child/runtime_features.h" | 13 #include "content/child/runtime_features.h" |
| 14 #include "content/child/web_database_observer_impl.h" | 14 #include "content/child/web_database_observer_impl.h" |
| 15 #include "content/common/worker_messages.h" | 15 #include "content/common/worker_messages.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "content/renderer/appcache_frontend_impl.h" |
| 17 #include "content/worker/websharedworker_stub.h" | 18 #include "content/worker/websharedworker_stub.h" |
| 18 #include "content/worker/worker_webkitplatformsupport_impl.h" | 19 #include "content/worker/worker_webkitplatformsupport_impl.h" |
| 19 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
| 20 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 21 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 21 #include "third_party/WebKit/public/web/WebDatabase.h" | 22 #include "third_party/WebKit/public/web/WebDatabase.h" |
| 22 #include "third_party/WebKit/public/web/WebKit.h" | 23 #include "third_party/WebKit/public/web/WebKit.h" |
| 23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 24 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 24 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 25 #include "webkit/renderer/appcache/appcache_frontend_impl.h" | |
| 26 | 26 |
| 27 using WebKit::WebRuntimeFeatures; | 27 using WebKit::WebRuntimeFeatures; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls = | 31 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls = |
| 32 LAZY_INSTANCE_INITIALIZER; | 32 LAZY_INSTANCE_INITIALIZER; |
| 33 | 33 |
| 34 WorkerThread::WorkerThread() { | 34 WorkerThread::WorkerThread() { |
| 35 lazy_tls.Pointer()->Set(this); | 35 lazy_tls.Pointer()->Set(this); |
| 36 webkit_platform_support_.reset(new WorkerWebKitPlatformSupportImpl( | 36 webkit_platform_support_.reset(new WorkerWebKitPlatformSupportImpl( |
| 37 thread_safe_sender(), | 37 thread_safe_sender(), |
| 38 sync_message_filter(), | 38 sync_message_filter(), |
| 39 quota_message_filter())); | 39 quota_message_filter())); |
| 40 WebKit::initialize(webkit_platform_support_.get()); | 40 WebKit::initialize(webkit_platform_support_.get()); |
| 41 | 41 |
| 42 appcache_dispatcher_.reset( | 42 appcache_dispatcher_.reset( |
| 43 new AppCacheDispatcher(this, new appcache::AppCacheFrontendImpl())); | 43 new AppCacheDispatcher(this, new AppCacheFrontendImpl())); |
| 44 | 44 |
| 45 web_database_observer_impl_.reset( | 45 web_database_observer_impl_.reset( |
| 46 new WebDatabaseObserverImpl(sync_message_filter())); | 46 new WebDatabaseObserverImpl(sync_message_filter())); |
| 47 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); | 47 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); |
| 48 db_message_filter_ = new DBMessageFilter(); | 48 db_message_filter_ = new DBMessageFilter(); |
| 49 channel()->AddFilter(db_message_filter_.get()); | 49 channel()->AddFilter(db_message_filter_.get()); |
| 50 | 50 |
| 51 indexed_db_message_filter_ = new IndexedDBMessageFilter( | 51 indexed_db_message_filter_ = new IndexedDBMessageFilter( |
| 52 thread_safe_sender()); | 52 thread_safe_sender()); |
| 53 channel()->AddFilter(indexed_db_message_filter_.get()); | 53 channel()->AddFilter(indexed_db_message_filter_.get()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { | 113 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { |
| 114 worker_stubs_.erase(stub); | 114 worker_stubs_.erase(stub); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { | 117 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { |
| 118 worker_stubs_.insert(stub); | 118 worker_stubs_.insert(stub); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace content | 121 } // namespace content |
| OLD | NEW |