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/plugin/plugin_thread.h" | 5 #include "content/plugin/plugin_thread.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(TOOLKIT_USES_GTK) | 9 #if defined(TOOLKIT_USES_GTK) |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace { | 42 namespace { |
43 | 43 |
44 class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { | 44 class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { |
45 public: | 45 public: |
46 EnsureTerminateMessageFilter() {} | 46 EnsureTerminateMessageFilter() {} |
47 ~EnsureTerminateMessageFilter() {} | 47 ~EnsureTerminateMessageFilter() {} |
48 | 48 |
49 private: | 49 private: |
50 virtual void OnChannelError() { | 50 virtual void OnChannelError() { |
51 // How long we wait before forcibly shutting down the process. | 51 // How long we wait before forcibly shutting down the process. |
52 const int kPluginProcessTerminateTimeoutMs = 3000; | 52 const base::TimeDelta kPluginProcessTerminateTimeout = |
| 53 base::TimeDelta::FromSeconds(3); |
53 // Ensure that we don't wait indefinitely for the plugin to shutdown. | 54 // Ensure that we don't wait indefinitely for the plugin to shutdown. |
54 // as the browser does not terminate plugin processes on shutdown. | 55 // as the browser does not terminate plugin processes on shutdown. |
55 // We achieve this by posting an exit process task on the IO thread. | 56 // We achieve this by posting an exit process task on the IO thread. |
56 MessageLoop::current()->PostDelayedTask( | 57 MessageLoop::current()->PostDelayedTask( |
57 FROM_HERE, | 58 FROM_HERE, |
58 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), | 59 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), |
59 kPluginProcessTerminateTimeoutMs); | 60 kPluginProcessTerminateTimeout); |
60 } | 61 } |
61 | 62 |
62 void Terminate() { | 63 void Terminate() { |
63 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 64 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
64 } | 65 } |
65 }; | 66 }; |
66 | 67 |
67 } // namespace | 68 } // namespace |
68 | 69 |
69 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = | 70 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 #endif | 169 #endif |
169 channel->set_incognito(incognito); | 170 channel->set_incognito(incognito); |
170 } | 171 } |
171 | 172 |
172 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 173 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
173 } | 174 } |
174 | 175 |
175 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 176 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
176 PluginChannel::NotifyRenderersOfPendingShutdown(); | 177 PluginChannel::NotifyRenderersOfPendingShutdown(); |
177 } | 178 } |
OLD | NEW |