| 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/webworkerclient_proxy.h" | 5 #include "chrome/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 "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/file_system/file_system_dispatcher.h" | 10 #include "chrome/common/file_system/file_system_dispatcher.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 GURL(origin.toString().utf8()), name, display_name, estimated_size, | 149 GURL(origin.toString().utf8()), name, display_name, estimated_size, |
| 150 &result))) | 150 &result))) |
| 151 return false; | 151 return false; |
| 152 | 152 |
| 153 return result; | 153 return result; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WebWorkerClientProxy::openFileSystem( | 156 void WebWorkerClientProxy::openFileSystem( |
| 157 WebKit::WebFileSystem::Type type, | 157 WebKit::WebFileSystem::Type type, |
| 158 long long size, | 158 long long size, |
| 159 bool create, |
| 159 WebKit::WebFileSystemCallbacks* callbacks) { | 160 WebKit::WebFileSystemCallbacks* callbacks) { |
| 160 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( | 161 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( |
| 161 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), | 162 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), |
| 162 size, true /* create */, new WebFileSystemCallbackDispatcher(callbacks)); | 163 size, create, new WebFileSystemCallbackDispatcher(callbacks)); |
| 163 } | 164 } |
| 164 | 165 |
| 165 bool WebWorkerClientProxy::Send(IPC::Message* message) { | 166 bool WebWorkerClientProxy::Send(IPC::Message* message) { |
| 166 return WorkerThread::current()->Send(message); | 167 return WorkerThread::current()->Send(message); |
| 167 } | 168 } |
| 168 | 169 |
| 169 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { | 170 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { |
| 170 // Avoid a worker doing a while(1) from never exiting. | 171 // Avoid a worker doing a while(1) from never exiting. |
| 171 if (CommandLine::ForCurrentProcess()->HasSwitch( | 172 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 172 switches::kWebWorkerShareProcesses)) { | 173 switches::kWebWorkerShareProcesses)) { |
| 173 // Can't kill the process since there could be workers from other | 174 // Can't kill the process since there could be workers from other |
| 174 // renderer process. | 175 // renderer process. |
| 175 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
| 176 return; | 177 return; |
| 177 } | 178 } |
| 178 | 179 |
| 179 // This shuts down the process cleanly from the perspective of the browser | 180 // This shuts down the process cleanly from the perspective of the browser |
| 180 // process, and avoids the crashed worker infobar from appearing to the new | 181 // process, and avoids the crashed worker infobar from appearing to the new |
| 181 // page. It's ok to post several of theese, because the first executed task | 182 // page. It's ok to post several of theese, because the first executed task |
| 182 // will exit the message loop and subsequent ones won't be executed. | 183 // will exit the message loop and subsequent ones won't be executed. |
| 183 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 184 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 184 kill_process_factory_.NewRunnableMethod( | 185 kill_process_factory_.NewRunnableMethod( |
| 185 &WebWorkerClientProxy::workerContextDestroyed), | 186 &WebWorkerClientProxy::workerContextDestroyed), |
| 186 kMaxTimeForRunawayWorkerMs); | 187 kMaxTimeForRunawayWorkerMs); |
| 187 } | 188 } |
| OLD | NEW |