| 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( |
| 45 NewRunnableMethod(this, | 46 FROM_HERE, |
| 46 &PluginInstallationJobMonitorThread::WaitForJobThread)); | 47 base::Bind(&PluginInstallationJobMonitorThread::WaitForJobThread, this)); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void PluginInstallationJobMonitorThread::WaitForJobThread() { | 50 void PluginInstallationJobMonitorThread::WaitForJobThread() { |
| 50 if (!install_job_) { | 51 if (!install_job_) { |
| 51 DLOG(WARNING) << "Invalid job information"; | 52 DLOG(WARNING) << "Invalid job information"; |
| 52 NOTREACHED(); | 53 NOTREACHED(); |
| 53 return; | 54 return; |
| 54 } | 55 } |
| 55 | 56 |
| 56 DCHECK(install_job_completion_port_ == NULL); | 57 DCHECK(install_job_completion_port_ == NULL); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 Thread::Stop(); | 102 Thread::Stop(); |
| 102 ::CloseHandle(install_job_completion_port_); | 103 ::CloseHandle(install_job_completion_port_); |
| 103 install_job_completion_port_ = NULL; | 104 install_job_completion_port_ = NULL; |
| 104 } | 105 } |
| 105 | 106 |
| 106 bool PluginInstallationJobMonitorThread::AssignProcessToJob( | 107 bool PluginInstallationJobMonitorThread::AssignProcessToJob( |
| 107 HANDLE process_handle) { | 108 HANDLE process_handle) { |
| 108 BOOL result = AssignProcessToJobObject(install_job_, process_handle); | 109 BOOL result = AssignProcessToJobObject(install_job_, process_handle); |
| 109 return result ? true : false; | 110 return result ? true : false; |
| 110 } | 111 } |
| OLD | NEW |