OLD | NEW |
1 // Copyright (c) 2010 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 "chrome/default_plugin/plugin_install_job_monitor.h" | 5 #include "chrome/default_plugin/plugin_install_job_monitor.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/default_plugin/plugin_impl.h" | 8 #include "chrome/default_plugin/plugin_impl.h" |
9 | 9 |
10 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() | 10 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() |
11 : Thread("Chrome plugin install thread"), | 11 : Thread("Chrome plugin install thread"), |
12 install_job_completion_port_(NULL), | 12 install_job_completion_port_(NULL), |
13 stop_job_monitoring_(false), | 13 stop_job_monitoring_(false), |
14 plugin_window_(NULL), | 14 plugin_window_(NULL), |
15 install_job_(NULL) { | 15 install_job_(NULL) { |
16 } | 16 } |
17 | 17 |
18 PluginInstallationJobMonitorThread::~PluginInstallationJobMonitorThread() { | 18 PluginInstallationJobMonitorThread::~PluginInstallationJobMonitorThread() { |
| 19 // The way this class is used, Thread::Stop() has always been called |
| 20 // by the time we reach this point, so we do not need to call it |
| 21 // again. |
| 22 DCHECK(!Thread::IsRunning()); |
19 if (install_job_) { | 23 if (install_job_) { |
20 ::CloseHandle(install_job_); | 24 ::CloseHandle(install_job_); |
21 install_job_ = NULL; | 25 install_job_ = NULL; |
22 } | 26 } |
23 } | 27 } |
24 | 28 |
25 bool PluginInstallationJobMonitorThread::Initialize() { | 29 bool PluginInstallationJobMonitorThread::Initialize() { |
26 DCHECK(install_job_ == NULL); | 30 DCHECK(install_job_ == NULL); |
27 | 31 |
28 install_job_ = ::CreateJobObject(NULL, NULL); | 32 install_job_ = ::CreateJobObject(NULL, NULL); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Thread::Stop(); | 101 Thread::Stop(); |
98 ::CloseHandle(install_job_completion_port_); | 102 ::CloseHandle(install_job_completion_port_); |
99 install_job_completion_port_ = NULL; | 103 install_job_completion_port_ = NULL; |
100 } | 104 } |
101 | 105 |
102 bool PluginInstallationJobMonitorThread::AssignProcessToJob( | 106 bool PluginInstallationJobMonitorThread::AssignProcessToJob( |
103 HANDLE process_handle) { | 107 HANDLE process_handle) { |
104 BOOL result = AssignProcessToJobObject(install_job_, process_handle); | 108 BOOL result = AssignProcessToJobObject(install_job_, process_handle); |
105 return result ? true : false; | 109 return result ? true : false; |
106 } | 110 } |
OLD | NEW |