| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 blink::WebWorkerPermissionClientProxy* | 81 blink::WebWorkerPermissionClientProxy* |
| 82 WebSharedWorkerClientProxy::createWorkerPermissionClientProxy( | 82 WebSharedWorkerClientProxy::createWorkerPermissionClientProxy( |
| 83 const blink::WebSecurityOrigin& origin) { | 83 const blink::WebSecurityOrigin& origin) { |
| 84 return new SharedWorkerPermissionClientProxy( | 84 return new SharedWorkerPermissionClientProxy( |
| 85 GURL(origin.toString()), origin.isUnique(), route_id_, | 85 GURL(origin.toString()), origin.isUnique(), route_id_, |
| 86 ChildThread::current()->thread_safe_sender()); | 86 ChildThread::current()->thread_safe_sender()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // TODO(kinuko): Deprecate these methods. | |
| 90 bool WebSharedWorkerClientProxy::allowDatabase(WebFrame* frame, | |
| 91 const WebString& name, | |
| 92 const WebString& display_name, | |
| 93 unsigned long estimated_size) { | |
| 94 return false; | |
| 95 } | |
| 96 | |
| 97 bool WebSharedWorkerClientProxy::allowFileSystem() { | |
| 98 return false; | |
| 99 } | |
| 100 | |
| 101 bool WebSharedWorkerClientProxy::allowIndexedDB(const blink::WebString& name) { | |
| 102 return false; | |
| 103 } | |
| 104 | |
| 105 void WebSharedWorkerClientProxy::dispatchDevToolsMessage( | 89 void WebSharedWorkerClientProxy::dispatchDevToolsMessage( |
| 106 const WebString& message) { | 90 const WebString& message) { |
| 107 if (devtools_agent_) | 91 if (devtools_agent_) |
| 108 devtools_agent_->SendDevToolsMessage(message); | 92 devtools_agent_->SendDevToolsMessage(message); |
| 109 } | 93 } |
| 110 | 94 |
| 111 void WebSharedWorkerClientProxy::saveDevToolsAgentState( | 95 void WebSharedWorkerClientProxy::saveDevToolsAgentState( |
| 112 const blink::WebString& state) { | 96 const blink::WebString& state) { |
| 113 if (devtools_agent_) | 97 if (devtools_agent_) |
| 114 devtools_agent_->SaveDevToolsAgentState(state); | 98 devtools_agent_->SaveDevToolsAgentState(state); |
| 115 } | 99 } |
| 116 | 100 |
| 117 bool WebSharedWorkerClientProxy::Send(IPC::Message* message) { | 101 bool WebSharedWorkerClientProxy::Send(IPC::Message* message) { |
| 118 return WorkerThread::current()->Send(message); | 102 return WorkerThread::current()->Send(message); |
| 119 } | 103 } |
| 120 | 104 |
| 121 void WebSharedWorkerClientProxy::EnsureWorkerContextTerminates() { | 105 void WebSharedWorkerClientProxy::EnsureWorkerContextTerminates() { |
| 122 // This shuts down the process cleanly from the perspective of the browser | 106 // This shuts down the process cleanly from the perspective of the browser |
| 123 // process, and avoids the crashed worker infobar from appearing to the new | 107 // process, and avoids the crashed worker infobar from appearing to the new |
| 124 // page. It's ok to post several of theese, because the first executed task | 108 // page. It's ok to post several of theese, because the first executed task |
| 125 // will exit the message loop and subsequent ones won't be executed. | 109 // will exit the message loop and subsequent ones won't be executed. |
| 126 base::MessageLoop::current()->PostDelayedTask( | 110 base::MessageLoop::current()->PostDelayedTask( |
| 127 FROM_HERE, | 111 FROM_HERE, |
| 128 base::Bind(&WebSharedWorkerClientProxy::workerContextDestroyed, | 112 base::Bind(&WebSharedWorkerClientProxy::workerContextDestroyed, |
| 129 weak_factory_.GetWeakPtr()), | 113 weak_factory_.GetWeakPtr()), |
| 130 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); | 114 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); |
| 131 } | 115 } |
| 132 | 116 |
| 133 } // namespace content | 117 } // namespace content |
| OLD | NEW |