| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/service/service_process_control_manager.h" | 5 #include "chrome/browser/service/service_process_control_manager.h" |
| 6 | 6 |
| 7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return *i; | 29 return *i; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Couldn't find a ServiceProcess so construct a new one. | 32 // Couldn't find a ServiceProcess so construct a new one. |
| 33 ServiceProcessControl* process = new ServiceProcessControl(profile, type); | 33 ServiceProcessControl* process = new ServiceProcessControl(profile, type); |
| 34 process_control_list_.push_back(process); | 34 process_control_list_.push_back(process); |
| 35 return process; | 35 return process; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ServiceProcessControlManager::Shutdown() { | 38 void ServiceProcessControlManager::Shutdown() { |
| 39 // TODO(hclam): Normally we should just delete the list but for simplicity |
| 40 // we also shutdown the service processes. |
| 41 for (ServiceProcessControlList::iterator i = process_control_list_.begin(); |
| 42 i != process_control_list_.end(); ++i) { |
| 43 (*i)->Shutdown(); |
| 44 } |
| 39 STLDeleteElements(&process_control_list_); | 45 STLDeleteElements(&process_control_list_); |
| 40 } | 46 } |
| 41 | 47 |
| 42 // static | 48 // static |
| 43 ServiceProcessControlManager* ServiceProcessControlManager::instance() { | 49 ServiceProcessControlManager* ServiceProcessControlManager::instance() { |
| 44 return Singleton<ServiceProcessControlManager>::get(); | 50 return Singleton<ServiceProcessControlManager>::get(); |
| 45 } | 51 } |
| OLD | NEW |