| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 appcache_host_id_ = host->host_id(); | 123 appcache_host_id_ = host->host_id(); |
| 124 return host; | 124 return host; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void WebWorkerClientProxy::openFileSystem( | 127 void WebWorkerClientProxy::openFileSystem( |
| 128 WebKit::WebFileSystem::Type type, | 128 WebKit::WebFileSystem::Type type, |
| 129 long long size, | 129 long long size, |
| 130 WebKit::WebFileSystemCallbacks* callbacks) { | 130 WebKit::WebFileSystemCallbacks* callbacks) { |
| 131 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( | 131 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( |
| 132 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), | 132 stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type), |
| 133 size, new WebFileSystemCallbackDispatcher(callbacks)); | 133 size, true /* create */, new WebFileSystemCallbackDispatcher(callbacks)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool WebWorkerClientProxy::Send(IPC::Message* message) { | 136 bool WebWorkerClientProxy::Send(IPC::Message* message) { |
| 137 return WorkerThread::current()->Send(message); | 137 return WorkerThread::current()->Send(message); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { | 140 void WebWorkerClientProxy::EnsureWorkerContextTerminates() { |
| 141 // Avoid a worker doing a while(1) from never exiting. | 141 // Avoid a worker doing a while(1) from never exiting. |
| 142 if (CommandLine::ForCurrentProcess()->HasSwitch( | 142 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 143 switches::kWebWorkerShareProcesses)) { | 143 switches::kWebWorkerShareProcesses)) { |
| 144 // Can't kill the process since there could be workers from other | 144 // Can't kill the process since there could be workers from other |
| 145 // renderer process. | 145 // renderer process. |
| 146 NOTIMPLEMENTED(); | 146 NOTIMPLEMENTED(); |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 | 149 |
| 150 // This shuts down the process cleanly from the perspective of the browser | 150 // This shuts down the process cleanly from the perspective of the browser |
| 151 // process, and avoids the crashed worker infobar from appearing to the new | 151 // process, and avoids the crashed worker infobar from appearing to the new |
| 152 // page. It's ok to post several of theese, because the first executed task | 152 // page. It's ok to post several of theese, because the first executed task |
| 153 // will exit the message loop and subsequent ones won't be executed. | 153 // will exit the message loop and subsequent ones won't be executed. |
| 154 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 154 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 155 kill_process_factory_.NewRunnableMethod( | 155 kill_process_factory_.NewRunnableMethod( |
| 156 &WebWorkerClientProxy::workerContextDestroyed), | 156 &WebWorkerClientProxy::workerContextDestroyed), |
| 157 kMaxTimeForRunawayWorkerMs); | 157 kMaxTimeForRunawayWorkerMs); |
| 158 } | 158 } |
| OLD | NEW |