OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webworkerclient_proxy.h" | 5 #include "content/worker/webworkerclient_proxy.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "content/common/content_switches.h" | 9 #include "content/common/content_switches.h" |
10 #include "content/common/file_system/file_system_dispatcher.h" | 10 #include "content/common/file_system/file_system_dispatcher.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void WebWorkerClientProxy::openFileSystem( | 161 void WebWorkerClientProxy::openFileSystem( |
162 WebKit::WebFileSystem::Type type, | 162 WebKit::WebFileSystem::Type type, |
163 long long size, | 163 long long size, |
164 bool create, | 164 bool create, |
165 WebKit::WebFileSystemCallbacks* callbacks) { | 165 WebKit::WebFileSystemCallbacks* callbacks) { |
166 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( | 166 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( |
167 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), | 167 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), |
168 size, create, new WebFileSystemCallbackDispatcher(callbacks)); | 168 size, create, new WebFileSystemCallbackDispatcher(callbacks)); |
169 } | 169 } |
170 | 170 |
171 void WebWorkerClientProxy::openFileSystem( | |
172 WebKit::WebFileSystem::Type type, | |
173 long long size, | |
174 WebKit::WebFileSystemCallbacks* callbacks) { | |
175 openFileSystem(type, size, true, callbacks); | |
176 } | |
177 | |
178 bool WebWorkerClientProxy::Send(IPC::Message* message) { | 171 bool WebWorkerClientProxy::Send(IPC::Message* message) { |
179 return WorkerThread::current()->Send(message); | 172 return WorkerThread::current()->Send(message); |
180 } | 173 } |
181 | 174 |
182 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { | 175 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { |
183 // Avoid a worker doing a while(1) from never exiting. | 176 // Avoid a worker doing a while(1) from never exiting. |
184 if (CommandLine::ForCurrentProcess()->HasSwitch( | 177 if (CommandLine::ForCurrentProcess()->HasSwitch( |
185 switches::kWebWorkerShareProcesses)) { | 178 switches::kWebWorkerShareProcesses)) { |
186 // Can't kill the process since there could be workers from other | 179 // Can't kill the process since there could be workers from other |
187 // renderer process. | 180 // renderer process. |
188 NOTIMPLEMENTED(); | 181 NOTIMPLEMENTED(); |
189 return; | 182 return; |
190 } | 183 } |
191 | 184 |
192 // This shuts down the process cleanly from the perspective of the browser | 185 // This shuts down the process cleanly from the perspective of the browser |
193 // process, and avoids the crashed worker infobar from appearing to the new | 186 // process, and avoids the crashed worker infobar from appearing to the new |
194 // page. It's ok to post several of theese, because the first executed task | 187 // page. It's ok to post several of theese, because the first executed task |
195 // will exit the message loop and subsequent ones won't be executed. | 188 // will exit the message loop and subsequent ones won't be executed. |
196 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 189 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
197 kill_process_factory_.NewRunnableMethod( | 190 kill_process_factory_.NewRunnableMethod( |
198 &WebWorkerClientProxy::workerContextDestroyed), | 191 &WebWorkerClientProxy::workerContextDestroyed), |
199 kMaxTimeForRunawayWorkerMs); | 192 kMaxTimeForRunawayWorkerMs); |
200 } | 193 } |
OLD | NEW |