| 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> |
| 11 #elif defined(OS_MACOSX) | 11 #elif defined(OS_MACOSX) |
| 12 #include <CoreFoundation/CoreFoundation.h> | 12 #include <CoreFoundation/CoreFoundation.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 19 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| 21 #include "base/threading/thread_local.h" | 22 #include "base/threading/thread_local.h" |
| 22 #include "content/common/child_process.h" | 23 #include "content/common/child_process.h" |
| 23 #include "content/common/npobject_util.h" | 24 #include "content/common/npobject_util.h" |
| 24 #include "content/common/plugin_messages.h" | 25 #include "content/common/plugin_messages.h" |
| 25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/plugin/content_plugin_client.h" | 27 #include "content/public/plugin/content_plugin_client.h" |
| 27 #include "ipc/ipc_channel_handle.h" | 28 #include "ipc/ipc_channel_handle.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 virtual void OnChannelError() { | 50 virtual void OnChannelError() { |
| 50 // How long we wait before forcibly shutting down the process. | 51 // How long we wait before forcibly shutting down the process. |
| 51 const int kPluginProcessTerminateTimeoutMs = 3000; | 52 const int kPluginProcessTerminateTimeoutMs = 3000; |
| 52 // 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. |
| 53 // as the browser does not terminate plugin processes on shutdown. | 54 // as the browser does not terminate plugin processes on shutdown. |
| 54 // 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. |
| 55 MessageLoop::current()->PostDelayedTask( | 56 MessageLoop::current()->PostDelayedTask( |
| 56 FROM_HERE, | 57 FROM_HERE, |
| 57 NewRunnableMethod(this, &EnsureTerminateMessageFilter::Terminate), | 58 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), |
| 58 kPluginProcessTerminateTimeoutMs); | 59 kPluginProcessTerminateTimeoutMs); |
| 59 } | 60 } |
| 60 | 61 |
| 61 void Terminate() { | 62 void Terminate() { |
| 62 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 63 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 63 } | 64 } |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace | 67 } // namespace |
| 67 | 68 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 #endif | 168 #endif |
| 168 channel->set_incognito(incognito); | 169 channel->set_incognito(incognito); |
| 169 } | 170 } |
| 170 | 171 |
| 171 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 172 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 175 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
| 175 PluginChannel::NotifyRenderersOfPendingShutdown(); | 176 PluginChannel::NotifyRenderersOfPendingShutdown(); |
| 176 } | 177 } |
| OLD | NEW |