Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(865)

Side by Side Diff: content/plugin/plugin_thread.cc

Issue 999033003: Remove uses of KillProcess() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include <CoreFoundation/CoreFoundation.h> 10 #include <CoreFoundation/CoreFoundation.h>
11 #endif 11 #endif
12 12
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/lazy_instance.h" 18 #include "base/lazy_instance.h"
19 #include "base/process/kill.h" 19 #include "base/process/process.h"
20 #include "base/process/process_handle.h"
21 #include "base/threading/thread_local.h" 20 #include "base/threading/thread_local.h"
22 #include "content/child/blink_platform_impl.h" 21 #include "content/child/blink_platform_impl.h"
23 #include "content/child/child_process.h" 22 #include "content/child/child_process.h"
24 #include "content/child/npapi/npobject_util.h" 23 #include "content/child/npapi/npobject_util.h"
25 #include "content/child/npapi/plugin_lib.h" 24 #include "content/child/npapi/plugin_lib.h"
26 #include "content/common/plugin_process_messages.h" 25 #include "content/common/plugin_process_messages.h"
27 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
28 #include "content/public/plugin/content_plugin_client.h" 27 #include "content/public/plugin/content_plugin_client.h"
29 #include "third_party/WebKit/public/web/WebKit.h" 28 #include "third_party/WebKit/public/web/WebKit.h"
30 #include "ipc/ipc_channel_handle.h" 29 #include "ipc/ipc_channel_handle.h"
(...skipping 19 matching lines...) Expand all
50 // as the browser does not terminate plugin processes on shutdown. 49 // as the browser does not terminate plugin processes on shutdown.
51 // We achieve this by posting an exit process task on the IO thread. 50 // We achieve this by posting an exit process task on the IO thread.
52 base::MessageLoop::current()->PostDelayedTask( 51 base::MessageLoop::current()->PostDelayedTask(
53 FROM_HERE, 52 FROM_HERE,
54 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), 53 base::Bind(&EnsureTerminateMessageFilter::Terminate, this),
55 kPluginProcessTerminateTimeout); 54 kPluginProcessTerminateTimeout);
56 } 55 }
57 56
58 private: 57 private:
59 void Terminate() { 58 void Terminate() {
60 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 59 base::Process::Current().Terminate(0, false);
61 } 60 }
62 }; 61 };
63 62
64 } // namespace 63 } // namespace
65 64
66 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = 65 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls =
67 LAZY_INSTANCE_INITIALIZER; 66 LAZY_INSTANCE_INITIALIZER;
68 67
69 PluginThread::PluginThread() 68 PluginThread::PluginThread()
70 : preloaded_plugin_module_(NULL), 69 : preloaded_plugin_module_(NULL),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 ChildThreadImpl::Shutdown(); 108 ChildThreadImpl::Shutdown();
110 109
111 if (preloaded_plugin_module_) { 110 if (preloaded_plugin_module_) {
112 base::UnloadNativeLibrary(preloaded_plugin_module_); 111 base::UnloadNativeLibrary(preloaded_plugin_module_);
113 preloaded_plugin_module_ = NULL; 112 preloaded_plugin_module_ = NULL;
114 } 113 }
115 NPChannelBase::CleanupChannels(); 114 NPChannelBase::CleanupChannels();
116 PluginLib::UnloadAllPlugins(); 115 PluginLib::UnloadAllPlugins();
117 116
118 if (forcefully_terminate_plugin_process_) 117 if (forcefully_terminate_plugin_process_)
119 base::KillProcess(base::GetCurrentProcessHandle(), 0, /* wait= */ false); 118 base::Process::Current().Terminate(0, /* wait= */ false);
120 119
cpu_(ooo_6.6-7.5) 2015/03/17 20:36:31 this code review is a good example of why bool par
121 lazy_tls.Pointer()->Set(NULL); 120 lazy_tls.Pointer()->Set(NULL);
122 } 121 }
123 122
124 PluginThread* PluginThread::current() { 123 PluginThread* PluginThread::current() {
125 return lazy_tls.Pointer()->Get(); 124 return lazy_tls.Pointer()->Get();
126 } 125 }
127 126
128 bool PluginThread::OnControlMessageReceived(const IPC::Message& msg) { 127 bool PluginThread::OnControlMessageReceived(const IPC::Message& msg) {
129 bool handled = true; 128 bool handled = true;
130 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) 129 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg)
(...skipping 21 matching lines...) Expand all
152 } 151 }
153 152
154 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); 153 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle));
155 } 154 }
156 155
157 void PluginThread::OnNotifyRenderersOfPendingShutdown() { 156 void PluginThread::OnNotifyRenderersOfPendingShutdown() {
158 PluginChannel::NotifyRenderersOfPendingShutdown(); 157 PluginChannel::NotifyRenderersOfPendingShutdown();
159 } 158 }
160 159
161 } // namespace content 160 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698