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 "chrome/default_plugin/plugin_install_job_monitor.h" | 5 #include "chrome/default_plugin/plugin_install_job_monitor.h" |
6 | 6 |
7 #include "base/bind.h" | |
7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
8 #include "chrome/default_plugin/plugin_impl.h" | 9 #include "chrome/default_plugin/plugin_impl.h" |
9 | 10 |
10 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() | 11 PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() |
11 : Thread("Chrome plugin install thread"), | 12 : Thread("Chrome plugin install thread"), |
12 install_job_completion_port_(NULL), | 13 install_job_completion_port_(NULL), |
13 stop_job_monitoring_(false), | 14 stop_job_monitoring_(false), |
14 plugin_window_(NULL), | 15 plugin_window_(NULL), |
15 install_job_(NULL) { | 16 install_job_(NULL) { |
16 } | 17 } |
(...skipping 17 matching lines...) Expand all Loading... | |
34 DLOG(ERROR) << "Failed to create plugin install job. Error = " | 35 DLOG(ERROR) << "Failed to create plugin install job. Error = " |
35 << ::GetLastError(); | 36 << ::GetLastError(); |
36 NOTREACHED(); | 37 NOTREACHED(); |
37 return false; | 38 return false; |
38 } | 39 } |
39 | 40 |
40 return Start(); | 41 return Start(); |
41 } | 42 } |
42 | 43 |
43 void PluginInstallationJobMonitorThread::Init() { | 44 void PluginInstallationJobMonitorThread::Init() { |
44 this->message_loop()->PostTask(FROM_HERE, | 45 this->message_loop()->PostTask(FROM_HERE, |
James Hawkins
2011/11/19 03:29:16
Same-col.
csilv
2011/11/22 19:42:44
Done.
| |
45 NewRunnableMethod(this, | 46 base::Bind(&PluginInstallationJobMonitorThread::WaitForJobThread, this)); |
46 &PluginInstallationJobMonitorThread::WaitForJobThread)); | |
47 } | 47 } |
48 | 48 |
49 void PluginInstallationJobMonitorThread::WaitForJobThread() { | 49 void PluginInstallationJobMonitorThread::WaitForJobThread() { |
50 if (!install_job_) { | 50 if (!install_job_) { |
51 DLOG(WARNING) << "Invalid job information"; | 51 DLOG(WARNING) << "Invalid job information"; |
52 NOTREACHED(); | 52 NOTREACHED(); |
53 return; | 53 return; |
54 } | 54 } |
55 | 55 |
56 DCHECK(install_job_completion_port_ == NULL); | 56 DCHECK(install_job_completion_port_ == NULL); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 Thread::Stop(); | 101 Thread::Stop(); |
102 ::CloseHandle(install_job_completion_port_); | 102 ::CloseHandle(install_job_completion_port_); |
103 install_job_completion_port_ = NULL; | 103 install_job_completion_port_ = NULL; |
104 } | 104 } |
105 | 105 |
106 bool PluginInstallationJobMonitorThread::AssignProcessToJob( | 106 bool PluginInstallationJobMonitorThread::AssignProcessToJob( |
107 HANDLE process_handle) { | 107 HANDLE process_handle) { |
108 BOOL result = AssignProcessToJobObject(install_job_, process_handle); | 108 BOOL result = AssignProcessToJobObject(install_job_, process_handle); |
109 return result ? true : false; | 109 return result ? true : false; |
110 } | 110 } |
OLD | NEW |