OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/nacl/browser/nacl_broker_service_win.h" |
6 | 6 |
7 #include "chrome/browser/nacl_host/nacl_process_host.h" | 7 #include "components/nacl/browser/nacl_process_host.h" |
8 #include "components/nacl/common/nacl_process_type.h" | 8 #include "components/nacl/common/nacl_process_type.h" |
9 #include "content/public/browser/browser_child_process_host_iterator.h" | 9 #include "content/public/browser/browser_child_process_host_iterator.h" |
10 | 10 |
11 using content::BrowserChildProcessHostIterator; | 11 using content::BrowserChildProcessHostIterator; |
12 | 12 |
13 namespace nacl { | |
14 | |
13 NaClBrokerService* NaClBrokerService::GetInstance() { | 15 NaClBrokerService* NaClBrokerService::GetInstance() { |
14 return Singleton<NaClBrokerService>::get(); | 16 return Singleton<NaClBrokerService>::get(); |
15 } | 17 } |
16 | 18 |
17 NaClBrokerService::NaClBrokerService() | 19 NaClBrokerService::NaClBrokerService() |
18 : loaders_running_(0) { | 20 : loaders_running_(0) { |
19 } | 21 } |
20 | 22 |
21 bool NaClBrokerService::StartBroker() { | 23 bool NaClBrokerService::StartBroker() { |
22 NaClBrokerHost* broker_host = new NaClBrokerHost; | 24 NaClBrokerHost* broker_host = new NaClBrokerHost; |
23 if (!broker_host->Init()) { | 25 if (!broker_host->Init()) { |
24 delete broker_host; | 26 delete broker_host; |
25 return false; | 27 return false; |
26 } | 28 } |
27 return true; | 29 return true; |
28 } | 30 } |
29 | 31 |
30 bool NaClBrokerService::LaunchLoader( | 32 bool NaClBrokerService::LaunchLoader( |
31 base::WeakPtr<NaClProcessHost> nacl_process_host, | 33 base::WeakPtr<nacl::NaClProcessHost> nacl_process_host, |
32 const std::string& loader_channel_id) { | 34 const std::string& loader_channel_id) { |
33 // Add task to the list | 35 // Add task to the list |
34 pending_launches_[loader_channel_id] = nacl_process_host; | 36 pending_launches_[loader_channel_id] = nacl_process_host; |
35 NaClBrokerHost* broker_host = GetBrokerHost(); | 37 NaClBrokerHost* broker_host = GetBrokerHost(); |
36 | 38 |
37 if (!broker_host) { | 39 if (!broker_host) { |
38 if (!StartBroker()) | 40 if (!StartBroker()) |
39 return false; | 41 return false; |
40 broker_host = GetBrokerHost(); | 42 broker_host = GetBrokerHost(); |
41 } | 43 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 | 88 |
87 NaClProcessHost* client = it->second.get(); | 89 NaClProcessHost* client = it->second.get(); |
88 if (client) | 90 if (client) |
89 client->OnDebugExceptionHandlerLaunchedByBroker(success); | 91 client->OnDebugExceptionHandlerLaunchedByBroker(success); |
90 pending_debuggers_.erase(it); | 92 pending_debuggers_.erase(it); |
91 } | 93 } |
92 | 94 |
93 NaClBrokerHost* NaClBrokerService::GetBrokerHost() { | 95 NaClBrokerHost* NaClBrokerService::GetBrokerHost() { |
94 BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_BROKER); | 96 BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_BROKER); |
95 while (!iter.Done()) { | 97 while (!iter.Done()) { |
96 NaClBrokerHost* host = static_cast<NaClBrokerHost*>(iter.GetDelegate()); | 98 NaClBrokerHost* host = static_cast<NaClBrokerHost*>( |
99 iter.GetDelegate()); | |
Mark Seaborn
2013/11/22 20:41:48
Nit: unnecessary whitespace change
| |
97 if (!host->IsTerminating()) | 100 if (!host->IsTerminating()) |
98 return host; | 101 return host; |
99 ++iter; | 102 ++iter; |
100 } | 103 } |
101 return NULL; | 104 return NULL; |
102 } | 105 } |
106 | |
107 } // namespace nacl | |
OLD | NEW |