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/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 "chrome/common/appcache/appcache_dispatcher.h" | 10 #include "chrome/common/appcache/appcache_dispatcher.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/db_message_filter.h" | 12 #include "chrome/common/db_message_filter.h" |
13 #include "chrome/common/web_database_observer_impl.h" | 13 #include "chrome/common/web_database_observer_impl.h" |
14 #include "chrome/common/worker_messages.h" | 14 #include "chrome/common/worker_messages.h" |
15 #include "chrome/worker/webworker_stub.h" | 15 #include "chrome/worker/webworker_stub.h" |
16 #include "chrome/worker/websharedworker_stub.h" | 16 #include "chrome/worker/websharedworker_stub.h" |
17 #include "chrome/worker/worker_webkitclient_impl.h" | 17 #include "chrome/worker/worker_webkitclient_impl.h" |
18 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
| 23 #include "webkit/glue/webkit_glue.h" |
23 | 24 |
24 using WebKit::WebRuntimeFeatures; | 25 using WebKit::WebRuntimeFeatures; |
25 | 26 |
26 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls( | 27 static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls( |
27 base::LINKER_INITIALIZED); | 28 base::LINKER_INITIALIZED); |
28 | 29 |
29 | 30 |
30 WorkerThread::WorkerThread() { | 31 WorkerThread::WorkerThread() { |
31 lazy_tls.Pointer()->Set(this); | 32 lazy_tls.Pointer()->Set(this); |
32 webkit_client_.reset(new WorkerWebKitClientImpl); | 33 webkit_client_.reset(new WorkerWebKitClientImpl); |
33 WebKit::initialize(webkit_client_.get()); | 34 WebKit::initialize(webkit_client_.get()); |
34 | 35 |
35 appcache_dispatcher_.reset(new AppCacheDispatcher(this)); | 36 appcache_dispatcher_.reset(new AppCacheDispatcher(this)); |
36 | 37 |
37 web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this)); | 38 web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this)); |
38 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); | 39 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); |
39 db_message_filter_ = new DBMessageFilter(); | 40 db_message_filter_ = new DBMessageFilter(); |
40 channel()->AddFilter(db_message_filter_.get()); | 41 channel()->AddFilter(db_message_filter_.get()); |
41 | 42 |
42 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
43 | 44 |
| 45 webkit_glue::EnableWebCoreLogChannels( |
| 46 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); |
| 47 |
44 WebKit::WebRuntimeFeatures::enableDatabase( | 48 WebKit::WebRuntimeFeatures::enableDatabase( |
45 !command_line.HasSwitch(switches::kDisableDatabases)); | 49 !command_line.HasSwitch(switches::kDisableDatabases)); |
46 | 50 |
47 WebKit::WebRuntimeFeatures::enableApplicationCache( | 51 WebKit::WebRuntimeFeatures::enableApplicationCache( |
48 !command_line.HasSwitch(switches::kDisableApplicationCache)); | 52 !command_line.HasSwitch(switches::kDisableApplicationCache)); |
49 | 53 |
50 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
51 // We don't yet support notifications on non-Windows, so hide it from pages. | 55 // We don't yet support notifications on non-Windows, so hide it from pages. |
52 WebRuntimeFeatures::enableNotifications( | 56 WebRuntimeFeatures::enableNotifications( |
53 !command_line.HasSwitch(switches::kDisableDesktopNotifications)); | 57 !command_line.HasSwitch(switches::kDisableDesktopNotifications)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 118 } |
115 } | 119 } |
116 | 120 |
117 void WorkerThread::RemoveWorkerStub(WebWorkerStubBase* stub) { | 121 void WorkerThread::RemoveWorkerStub(WebWorkerStubBase* stub) { |
118 worker_stubs_.erase(stub); | 122 worker_stubs_.erase(stub); |
119 } | 123 } |
120 | 124 |
121 void WorkerThread::AddWorkerStub(WebWorkerStubBase* stub) { | 125 void WorkerThread::AddWorkerStub(WebWorkerStubBase* stub) { |
122 worker_stubs_.insert(stub); | 126 worker_stubs_.insert(stub); |
123 } | 127 } |
OLD | NEW |