| Index: components/nacl/browser/nacl_broker_service_win.cc
|
| diff --git a/chrome/browser/nacl_host/nacl_broker_service_win.cc b/components/nacl/browser/nacl_broker_service_win.cc
|
| similarity index 76%
|
| rename from chrome/browser/nacl_host/nacl_broker_service_win.cc
|
| rename to components/nacl/browser/nacl_broker_service_win.cc
|
| index 0fb96f65a2b59a85df1cf06d62a92a0fb32c9845..07d3cd6021de24edbce195da66b5e57f16101309 100644
|
| --- a/chrome/browser/nacl_host/nacl_broker_service_win.cc
|
| +++ b/components/nacl/browser/nacl_broker_service_win.cc
|
| @@ -2,14 +2,16 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/nacl_host/nacl_broker_service_win.h"
|
| +#include "components/nacl/browser/nacl_broker_service_win.h"
|
|
|
| -#include "chrome/browser/nacl_host/nacl_process_host.h"
|
| +#include "components/nacl/browser/nacl_process_host.h"
|
| #include "components/nacl/common/nacl_process_type.h"
|
| #include "content/public/browser/browser_child_process_host_iterator.h"
|
|
|
| using content::BrowserChildProcessHostIterator;
|
|
|
| +namespace nacl {
|
| +
|
| NaClBrokerService* NaClBrokerService::GetInstance() {
|
| return Singleton<NaClBrokerService>::get();
|
| }
|
| @@ -19,7 +21,7 @@ NaClBrokerService::NaClBrokerService()
|
| }
|
|
|
| bool NaClBrokerService::StartBroker() {
|
| - NaClBrokerHost* broker_host = new NaClBrokerHost;
|
| + nacl::NaClBrokerHost* broker_host = new nacl::NaClBrokerHost;
|
| if (!broker_host->Init()) {
|
| delete broker_host;
|
| return false;
|
| @@ -28,11 +30,11 @@ bool NaClBrokerService::StartBroker() {
|
| }
|
|
|
| bool NaClBrokerService::LaunchLoader(
|
| - base::WeakPtr<NaClProcessHost> nacl_process_host,
|
| + base::WeakPtr<nacl::NaClProcessHost> nacl_process_host,
|
| const std::string& loader_channel_id) {
|
| // Add task to the list
|
| pending_launches_[loader_channel_id] = nacl_process_host;
|
| - NaClBrokerHost* broker_host = GetBrokerHost();
|
| + nacl::NaClBrokerHost* broker_host = GetBrokerHost();
|
|
|
| if (!broker_host) {
|
| if (!StartBroker())
|
| @@ -50,7 +52,7 @@ void NaClBrokerService::OnLoaderLaunched(const std::string& channel_id,
|
| if (pending_launches_.end() == it)
|
| NOTREACHED();
|
|
|
| - NaClProcessHost* client = it->second.get();
|
| + nacl::NaClProcessHost* client = it->second.get();
|
| if (client)
|
| client->OnProcessLaunchedByBroker(handle);
|
| pending_launches_.erase(it);
|
| @@ -61,17 +63,17 @@ void NaClBrokerService::OnLoaderDied() {
|
| DCHECK(loaders_running_ > 0);
|
| --loaders_running_;
|
| // Stop the broker only if there are no loaders running or being launched.
|
| - NaClBrokerHost* broker_host = GetBrokerHost();
|
| + nacl::NaClBrokerHost* broker_host = GetBrokerHost();
|
| if (loaders_running_ + pending_launches_.size() == 0 && broker_host != NULL) {
|
| broker_host->StopBroker();
|
| }
|
| }
|
|
|
| bool NaClBrokerService::LaunchDebugExceptionHandler(
|
| - base::WeakPtr<NaClProcessHost> nacl_process_host, int32 pid,
|
| + base::WeakPtr<nacl::NaClProcessHost> nacl_process_host, int32 pid,
|
| base::ProcessHandle process_handle, const std::string& startup_info) {
|
| pending_debuggers_[pid] = nacl_process_host;
|
| - NaClBrokerHost* broker_host = GetBrokerHost();
|
| + nacl::NaClBrokerHost* broker_host = GetBrokerHost();
|
| if (!broker_host)
|
| return false;
|
| return broker_host->LaunchDebugExceptionHandler(pid, process_handle,
|
| @@ -84,19 +86,22 @@ void NaClBrokerService::OnDebugExceptionHandlerLaunched(int32 pid,
|
| if (pending_debuggers_.end() == it)
|
| NOTREACHED();
|
|
|
| - NaClProcessHost* client = it->second.get();
|
| + nacl::NaClProcessHost* client = it->second.get();
|
| if (client)
|
| client->OnDebugExceptionHandlerLaunchedByBroker(success);
|
| pending_debuggers_.erase(it);
|
| }
|
|
|
| -NaClBrokerHost* NaClBrokerService::GetBrokerHost() {
|
| +nacl::NaClBrokerHost* NaClBrokerService::GetBrokerHost() {
|
| BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_BROKER);
|
| while (!iter.Done()) {
|
| - NaClBrokerHost* host = static_cast<NaClBrokerHost*>(iter.GetDelegate());
|
| + nacl::NaClBrokerHost* host = static_cast<nacl::NaClBrokerHost*>(
|
| + iter.GetDelegate());
|
| if (!host->IsTerminating())
|
| return host;
|
| ++iter;
|
| }
|
| return NULL;
|
| }
|
| +
|
| +} // namespace nacl
|
|
|