OLD | NEW |
1 // Copyright (c) 2011 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/common/appcache/appcache_dispatcher.h" | 10 #include "content/common/appcache/appcache_dispatcher.h" |
11 #include "content/common/db_message_filter.h" | 11 #include "content/common/db_message_filter.h" |
| 12 #include "content/common/indexed_db/indexed_db_message_filter.h" |
12 #include "content/common/web_database_observer_impl.h" | 13 #include "content/common/web_database_observer_impl.h" |
13 #include "content/common/worker_messages.h" | 14 #include "content/common/worker_messages.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "content/worker/websharedworker_stub.h" | 16 #include "content/worker/websharedworker_stub.h" |
16 #include "content/worker/worker_webkitplatformsupport_impl.h" | 17 #include "content/worker/worker_webkitplatformsupport_impl.h" |
17 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis
try.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis
try.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
(...skipping 10 matching lines...) Expand all Loading... |
32 webkit_platform_support_.reset(new WorkerWebKitPlatformSupportImpl); | 33 webkit_platform_support_.reset(new WorkerWebKitPlatformSupportImpl); |
33 WebKit::initialize(webkit_platform_support_.get()); | 34 WebKit::initialize(webkit_platform_support_.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 |
| 43 indexed_db_message_filter_ = new IndexedDBMessageFilter; |
| 44 channel()->AddFilter(indexed_db_message_filter_.get()); |
| 45 |
42 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 46 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
43 | 47 |
44 webkit_glue::EnableWebCoreLogChannels( | 48 webkit_glue::EnableWebCoreLogChannels( |
45 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); | 49 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); |
46 | 50 |
47 WebKit::WebRuntimeFeatures::enableDatabase( | 51 WebKit::WebRuntimeFeatures::enableDatabase( |
48 !command_line.HasSwitch(switches::kDisableDatabases)); | 52 !command_line.HasSwitch(switches::kDisableDatabases)); |
49 | 53 |
50 WebKit::WebRuntimeFeatures::enableApplicationCache( | 54 WebKit::WebRuntimeFeatures::enableApplicationCache( |
51 !command_line.HasSwitch(switches::kDisableApplicationCache)); | 55 !command_line.HasSwitch(switches::kDisableApplicationCache)); |
52 | 56 |
53 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
54 // We don't yet support notifications on non-Windows, so hide it from pages. | 58 // We don't yet support notifications on non-Windows, so hide it from pages. |
55 WebRuntimeFeatures::enableNotifications( | 59 WebRuntimeFeatures::enableNotifications( |
56 !command_line.HasSwitch(switches::kDisableDesktopNotifications)); | 60 !command_line.HasSwitch(switches::kDisableDesktopNotifications)); |
57 #endif | 61 #endif |
58 | 62 |
59 WebRuntimeFeatures::enableSockets( | 63 WebRuntimeFeatures::enableSockets( |
60 !command_line.HasSwitch(switches::kDisableWebSockets)); | 64 !command_line.HasSwitch(switches::kDisableWebSockets)); |
61 | 65 |
62 WebRuntimeFeatures::enableFileSystem( | 66 WebRuntimeFeatures::enableFileSystem( |
63 !command_line.HasSwitch(switches::kDisableFileSystem)); | 67 !command_line.HasSwitch(switches::kDisableFileSystem)); |
| 68 |
| 69 WebRuntimeFeatures::enableIndexedDatabase(true); |
64 } | 70 } |
65 | 71 |
66 WorkerThread::~WorkerThread() { | 72 WorkerThread::~WorkerThread() { |
67 // Shutdown in reverse of the initialization order. | 73 // Shutdown in reverse of the initialization order. |
| 74 channel()->RemoveFilter(indexed_db_message_filter_.get()); |
| 75 indexed_db_message_filter_ = NULL; |
| 76 |
68 channel()->RemoveFilter(db_message_filter_.get()); | 77 channel()->RemoveFilter(db_message_filter_.get()); |
69 db_message_filter_ = NULL; | 78 db_message_filter_ = NULL; |
70 | 79 |
71 WebKit::shutdown(); | 80 WebKit::shutdown(); |
72 lazy_tls.Pointer()->Set(NULL); | 81 lazy_tls.Pointer()->Set(NULL); |
73 } | 82 } |
74 | 83 |
75 WorkerThread* WorkerThread::current() { | 84 WorkerThread* WorkerThread::current() { |
76 return lazy_tls.Pointer()->Get(); | 85 return lazy_tls.Pointer()->Get(); |
77 } | 86 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 118 } |
110 } | 119 } |
111 | 120 |
112 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { | 121 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { |
113 worker_stubs_.erase(stub); | 122 worker_stubs_.erase(stub); |
114 } | 123 } |
115 | 124 |
116 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { | 125 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { |
117 worker_stubs_.insert(stub); | 126 worker_stubs_.insert(stub); |
118 } | 127 } |
OLD | NEW |