OLD | NEW |
1 // Copyright (c) 2012 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> |
11 #elif defined(OS_MACOSX) | 11 #elif defined(OS_MACOSX) |
(...skipping 30 matching lines...) Expand all 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 base::TimeDelta kPluginProcessTerminateTimeout = | 52 const int kPluginProcessTerminateTimeoutMs = 3000; |
53 base::TimeDelta::FromSeconds(3); | |
54 // Ensure that we don't wait indefinitely for the plugin to shutdown. | 53 // Ensure that we don't wait indefinitely for the plugin to shutdown. |
55 // as the browser does not terminate plugin processes on shutdown. | 54 // as the browser does not terminate plugin processes on shutdown. |
56 // We achieve this by posting an exit process task on the IO thread. | 55 // We achieve this by posting an exit process task on the IO thread. |
57 MessageLoop::current()->PostDelayedTask( | 56 MessageLoop::current()->PostDelayedTask( |
58 FROM_HERE, | 57 FROM_HERE, |
59 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), | 58 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), |
60 kPluginProcessTerminateTimeout); | 59 kPluginProcessTerminateTimeoutMs); |
61 } | 60 } |
62 | 61 |
63 void Terminate() { | 62 void Terminate() { |
64 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 63 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
65 } | 64 } |
66 }; | 65 }; |
67 | 66 |
68 } // namespace | 67 } // namespace |
69 | 68 |
70 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = | 69 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 #endif | 168 #endif |
170 channel->set_incognito(incognito); | 169 channel->set_incognito(incognito); |
171 } | 170 } |
172 | 171 |
173 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 172 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
174 } | 173 } |
175 | 174 |
176 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 175 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
177 PluginChannel::NotifyRenderersOfPendingShutdown(); | 176 PluginChannel::NotifyRenderersOfPendingShutdown(); |
178 } | 177 } |
OLD | NEW |