Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ | 5 #ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ |
| 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ | 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/thread.h" | 11 #include "base/thread.h" |
| 12 #include "base/ref_counted.h" | |
| 12 | 13 |
| 13 // Provides the plugin installation job monitoring functionality. | 14 // Provides the plugin installation job monitoring functionality. |
| 14 // The PluginInstallationJobMonitorThread class represents a background | 15 // The PluginInstallationJobMonitorThread class represents a background |
| 15 // thread which monitors the install job completion port which is associated | 16 // thread which monitors the install job completion port which is associated |
| 16 // with the job when an instance of this class is initialized. | 17 // with the job when an instance of this class is initialized. |
| 17 class PluginInstallationJobMonitorThread : public base::Thread { | 18 class PluginInstallationJobMonitorThread : public base::Thread, |
| 19 public base::RefCountedThreadSafe<PluginInstallationJobMonitorThread> { | |
|
jeremy
2009/01/26 23:00:34
Also 4 spaces.
Personally, I'd actually format th
John Grabowski
2009/01/27 00:31:25
Reformatted.
| |
| 20 | |
| 18 public: | 21 public: |
| 19 PluginInstallationJobMonitorThread(); | 22 PluginInstallationJobMonitorThread(); |
| 20 virtual ~PluginInstallationJobMonitorThread(); | 23 virtual ~PluginInstallationJobMonitorThread(); |
| 21 | 24 |
| 22 // Initializes the plugin install job. This involves creating the job object | 25 // Initializes the plugin install job. This involves creating the job object |
| 23 // and starting the thread which monitors the job completion port. | 26 // and starting the thread which monitors the job completion port. |
| 24 // Returns true on success. | 27 // Returns true on success. |
| 25 bool Initialize(); | 28 bool Initialize(); |
| 26 | 29 |
| 27 // Stops job monitoring and invokes the base Stop function. | 30 // Stops job monitoring and invokes the base Stop function. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 39 | 42 |
| 40 // Adds a process to the job object. | 43 // Adds a process to the job object. |
| 41 // | 44 // |
| 42 // Parameters: | 45 // Parameters: |
| 43 // process_handle | 46 // process_handle |
| 44 // Handle to the process which is to be added to the plugin install job. | 47 // Handle to the process which is to be added to the plugin install job. |
| 45 // Returns true on success. | 48 // Returns true on success. |
| 46 bool AssignProcessToJob(HANDLE process_handle); | 49 bool AssignProcessToJob(HANDLE process_handle); |
| 47 | 50 |
| 48 protected: | 51 protected: |
| 52 // Installs a task on our thread to call WaitForJobThread(). We | |
| 53 // can't call it directly since we would deadlock (thread which | |
| 54 // creates me blocks until Start() returns, and Start() doesn't | |
| 55 // return until Init() does). | |
| 56 virtual void Init(); | |
| 57 | |
| 49 // Blocks on the plugin installation job completion port by invoking the | 58 // Blocks on the plugin installation job completion port by invoking the |
| 50 // GetQueuedCompletionStatus API. | 59 // GetQueuedCompletionStatus API. |
| 51 // We return from this function when the job monitoring thread is stopped. | 60 // We return from this function when the job monitoring thread is stopped. |
| 52 virtual void Init(); | 61 virtual void WaitForJobThread(); |
| 53 | 62 |
| 54 private: | 63 private: |
| 55 // The install job completion port. Created in Init. | 64 // The install job completion port. Created in Init. |
| 56 HANDLE install_job_completion_port_; | 65 HANDLE install_job_completion_port_; |
| 57 // Indicates that job monitoring is to be stopped | 66 // Indicates that job monitoring is to be stopped |
| 58 bool stop_job_monitoring_; | 67 bool stop_job_monitoring_; |
| 59 // The install job. Should be created before the job monitor thread | 68 // The install job. Should be created before the job monitor thread |
| 60 // is started. | 69 // is started. |
| 61 HANDLE install_job_; | 70 HANDLE install_job_; |
| 62 // The plugin window handle. | 71 // The plugin window handle. |
| 63 HWND plugin_window_; | 72 HWND plugin_window_; |
| 64 | 73 |
| 65 DISALLOW_EVIL_CONSTRUCTORS(PluginInstallationJobMonitorThread); | 74 DISALLOW_EVIL_CONSTRUCTORS(PluginInstallationJobMonitorThread); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ | 77 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ |
| 69 | 78 |
| OLD | NEW |