OLD | NEW |
1 // Copyright (c) 2012 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/websharedworkerclient_proxy.h" | 5 #include "content/worker/websharedworkerclient_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/common/fileapi/file_system_dispatcher.h" | 10 #include "content/common/fileapi/file_system_dispatcher.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 using WebKit::WebApplicationCacheHost; | 27 using WebKit::WebApplicationCacheHost; |
28 using WebKit::WebFrame; | 28 using WebKit::WebFrame; |
29 using WebKit::WebMessagePortChannel; | 29 using WebKit::WebMessagePortChannel; |
30 using WebKit::WebMessagePortChannelArray; | 30 using WebKit::WebMessagePortChannelArray; |
31 using WebKit::WebSecurityOrigin; | 31 using WebKit::WebSecurityOrigin; |
32 using WebKit::WebString; | 32 using WebKit::WebString; |
33 using WebKit::WebWorker; | 33 using WebKit::WebWorker; |
34 using WebKit::WebSharedWorkerClient; | 34 using WebKit::WebSharedWorkerClient; |
35 | 35 |
| 36 namespace content { |
| 37 |
36 // How long to wait for worker to finish after it's been told to terminate. | 38 // How long to wait for worker to finish after it's been told to terminate. |
37 #define kMaxTimeForRunawayWorkerSeconds 3 | 39 #define kMaxTimeForRunawayWorkerSeconds 3 |
38 | 40 |
39 WebSharedWorkerClientProxy::WebSharedWorkerClientProxy( | 41 WebSharedWorkerClientProxy::WebSharedWorkerClientProxy( |
40 int route_id, WebSharedWorkerStub* stub) | 42 int route_id, WebSharedWorkerStub* stub) |
41 : route_id_(route_id), | 43 : route_id_(route_id), |
42 appcache_host_id_(0), | 44 appcache_host_id_(0), |
43 stub_(stub), | 45 stub_(stub), |
44 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 46 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
45 devtools_agent_(NULL) { | 47 devtools_agent_(NULL) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // This shuts down the process cleanly from the perspective of the browser | 197 // This shuts down the process cleanly from the perspective of the browser |
196 // process, and avoids the crashed worker infobar from appearing to the new | 198 // process, and avoids the crashed worker infobar from appearing to the new |
197 // page. It's ok to post several of theese, because the first executed task | 199 // page. It's ok to post several of theese, because the first executed task |
198 // will exit the message loop and subsequent ones won't be executed. | 200 // will exit the message loop and subsequent ones won't be executed. |
199 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 201 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
200 base::Bind( | 202 base::Bind( |
201 &WebSharedWorkerClientProxy::workerContextDestroyed, | 203 &WebSharedWorkerClientProxy::workerContextDestroyed, |
202 weak_factory_.GetWeakPtr()), | 204 weak_factory_.GetWeakPtr()), |
203 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); | 205 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); |
204 } | 206 } |
| 207 |
| 208 } // namespace content |
OLD | NEW |