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/browser/nacl_host/nacl_broker_service_win.h" | 5 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" |
6 | 6 |
7 #include "chrome/browser/nacl_host/nacl_process_host.h" | 7 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 8 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 9 |
| 10 using content::BrowserChildProcessHostIterator; |
8 | 11 |
9 NaClBrokerService* NaClBrokerService::GetInstance() { | 12 NaClBrokerService* NaClBrokerService::GetInstance() { |
10 return Singleton<NaClBrokerService>::get(); | 13 return Singleton<NaClBrokerService>::get(); |
11 } | 14 } |
12 | 15 |
13 NaClBrokerService::NaClBrokerService() | 16 NaClBrokerService::NaClBrokerService() |
14 : loaders_running_(0) { | 17 : loaders_running_(0) { |
15 } | 18 } |
16 | 19 |
17 bool NaClBrokerService::StartBroker() { | 20 bool NaClBrokerService::StartBroker() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void NaClBrokerService::OnLoaderDied() { | 58 void NaClBrokerService::OnLoaderDied() { |
56 --loaders_running_; | 59 --loaders_running_; |
57 // Stop the broker only if there are no loaders running or being launched. | 60 // Stop the broker only if there are no loaders running or being launched. |
58 NaClBrokerHost* broker_host = GetBrokerHost(); | 61 NaClBrokerHost* broker_host = GetBrokerHost(); |
59 if (loaders_running_ + pending_launches_.size() == 0 && broker_host != NULL) { | 62 if (loaders_running_ + pending_launches_.size() == 0 && broker_host != NULL) { |
60 broker_host->StopBroker(); | 63 broker_host->StopBroker(); |
61 } | 64 } |
62 } | 65 } |
63 | 66 |
64 NaClBrokerHost* NaClBrokerService::GetBrokerHost() { | 67 NaClBrokerHost* NaClBrokerService::GetBrokerHost() { |
65 BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_NACL_BROKER); | 68 BrowserChildProcessHostIterator iter(content::PROCESS_TYPE_NACL_BROKER); |
66 if (iter.Done()) | 69 if (iter.Done()) |
67 return NULL; | 70 return NULL; |
68 NaClBrokerHost* broker_host = static_cast<NaClBrokerHost*>(*iter); | 71 return static_cast<NaClBrokerHost*>(iter.GetDelegate()); |
69 return broker_host; | |
70 } | 72 } |
OLD | NEW |