summaryrefslogtreecommitdiffstats
path: root/chrome/browser/nacl_host
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-06-28 21:49:31 +0100
committerKristian Monsen <kristianm@google.com>2011-07-08 17:55:00 +0100
commitddb351dbec246cf1fab5ec20d2d5520909041de1 (patch)
tree158e3fb57bdcac07c7f1e767fde3c70687c9fbb1 /chrome/browser/nacl_host
parent6b92e04f5f151c896e3088e86f70db7081009308 (diff)
downloadexternal_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.zip
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.gz
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.bz2
Merge Chromium at r12.0.742.93: Initial merge by git
Change-Id: Ic5ee2fec31358bbee305f7e915442377bfa6cda6
Diffstat (limited to 'chrome/browser/nacl_host')
-rw-r--r--chrome/browser/nacl_host/nacl_broker_host_win.cc7
-rw-r--r--chrome/browser/nacl_host/nacl_broker_host_win.h4
-rw-r--r--chrome/browser/nacl_host/nacl_broker_service_win.cc14
-rw-r--r--chrome/browser/nacl_host/nacl_broker_service_win.h8
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc36
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.h19
6 files changed, 35 insertions, 53 deletions
diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc
index 7d0fbea..ed16610 100644
--- a/chrome/browser/nacl_host/nacl_broker_host_win.cc
+++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,9 +14,8 @@
#include "chrome/common/nacl_cmd_line.h"
#include "chrome/common/nacl_messages.h"
-NaClBrokerHost::NaClBrokerHost(
- ResourceDispatcherHost* resource_dispatcher_host)
- : BrowserChildProcessHost(NACL_BROKER_PROCESS, resource_dispatcher_host),
+NaClBrokerHost::NaClBrokerHost()
+ : BrowserChildProcessHost(NACL_BROKER_PROCESS),
stopping_(false) {
}
diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.h b/chrome/browser/nacl_host/nacl_broker_host_win.h
index f226564..82f6319 100644
--- a/chrome/browser/nacl_host/nacl_broker_host_win.h
+++ b/chrome/browser/nacl_host/nacl_broker_host_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,7 @@
class NaClBrokerHost : public BrowserChildProcessHost {
public:
- explicit NaClBrokerHost(ResourceDispatcherHost* resource_dispatcher_host);
+ NaClBrokerHost();
~NaClBrokerHost();
// This function starts the broker process. It needs to be called
diff --git a/chrome/browser/nacl_host/nacl_broker_service_win.cc b/chrome/browser/nacl_host/nacl_broker_service_win.cc
index a89e082..729155a 100644
--- a/chrome/browser/nacl_host/nacl_broker_service_win.cc
+++ b/chrome/browser/nacl_host/nacl_broker_service_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,19 +11,11 @@ NaClBrokerService* NaClBrokerService::GetInstance() {
}
NaClBrokerService::NaClBrokerService()
- : loaders_running_(0),
- resource_dispatcher_host_(NULL),
- initialized_(false) {
-}
-
-void NaClBrokerService::Init(ResourceDispatcherHost* resource_dispatcher_host) {
- if (!initialized_)
- resource_dispatcher_host_ = resource_dispatcher_host;
- initialized_ = true;
+ : loaders_running_(0) {
}
bool NaClBrokerService::StartBroker() {
- NaClBrokerHost* broker_host = new NaClBrokerHost(resource_dispatcher_host_);
+ NaClBrokerHost* broker_host = new NaClBrokerHost;
if (!broker_host->Init()) {
delete broker_host;
return false;
diff --git a/chrome/browser/nacl_host/nacl_broker_service_win.h b/chrome/browser/nacl_host/nacl_broker_service_win.h
index f4dcbca..c69da7b 100644
--- a/chrome/browser/nacl_host/nacl_broker_service_win.h
+++ b/chrome/browser/nacl_host/nacl_broker_service_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
#include <map>
#include "base/basictypes.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "chrome/browser/nacl_host/nacl_broker_host_win.h"
class NaClProcessHost;
@@ -19,8 +19,6 @@ class NaClBrokerService {
// Returns the NaClBrokerService singleton.
static NaClBrokerService* GetInstance();
- void Init(ResourceDispatcherHost* resource_dispatcher_host);
-
// Can be called several times, must be called before LaunchLoader.
bool StartBroker();
@@ -48,8 +46,6 @@ class NaClBrokerService {
NaClBrokerHost* GetBrokerHost();
int loaders_running_;
- bool initialized_;
- ResourceDispatcherHost* resource_dispatcher_host_;
PendingLaunchesMap pending_launches_;
DISALLOW_COPY_AND_ASSIGN(NaClBrokerService);
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 2b97881..38dfcad 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -19,7 +19,7 @@
#include "chrome/common/nacl_cmd_line.h"
#include "chrome/common/nacl_messages.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/renderer_host/render_message_filter.h"
+#include "chrome/browser/renderer_host/chrome_render_message_filter.h"
#include "ipc/ipc_switches.h"
#include "native_client/src/shared/imc/nacl_imc.h"
@@ -49,17 +49,15 @@ struct NaClProcessHost::NaClInternal {
std::vector<nacl::Handle> sockets_for_sel_ldr;
};
-NaClProcessHost::NaClProcessHost(
- ResourceDispatcherHost *resource_dispatcher_host,
- const std::wstring& url)
- : BrowserChildProcessHost(NACL_LOADER_PROCESS, resource_dispatcher_host),
- resource_dispatcher_host_(resource_dispatcher_host),
+NaClProcessHost::NaClProcessHost(const std::wstring& url)
+ : BrowserChildProcessHost(NACL_LOADER_PROCESS),
reply_msg_(NULL),
internal_(new NaClInternal()),
running_on_wow64_(false) {
set_name(url);
#if defined(OS_WIN)
- running_on_wow64_ = (base::win::GetWOW64Status() == base::win::WOW64_ENABLED);
+ running_on_wow64_ = (base::win::OSInfo::GetInstance()->wow64_status() ==
+ base::win::OSInfo::WOW64_ENABLED);
#endif
}
@@ -82,12 +80,13 @@ NaClProcessHost::~NaClProcessHost() {
// OnProcessLaunched didn't get called because the process couldn't launch.
// Don't keep the renderer hanging.
reply_msg_->set_reply_error();
- render_message_filter_->Send(reply_msg_);
+ chrome_render_message_filter_->Send(reply_msg_);
}
-bool NaClProcessHost::Launch(RenderMessageFilter* render_message_filter,
- int socket_count,
- IPC::Message* reply_msg) {
+bool NaClProcessHost::Launch(
+ ChromeRenderMessageFilter* chrome_render_message_filter,
+ int socket_count,
+ IPC::Message* reply_msg) {
#ifdef DISABLE_NACL
NOTIMPLEMENTED() << "Native Client disabled at build time";
return false;
@@ -124,7 +123,7 @@ bool NaClProcessHost::Launch(RenderMessageFilter* render_message_filter,
return false;
}
UmaNaclHistogramEnumeration(NACL_STARTED);
- render_message_filter_ = render_message_filter;
+ chrome_render_message_filter_ = chrome_render_message_filter;
reply_msg_ = reply_msg;
return true;
@@ -153,9 +152,8 @@ bool NaClProcessHost::LaunchSelLdr() {
// On Windows we might need to start the broker process to launch a new loader
#if defined(OS_WIN)
if (running_on_wow64_) {
- NaClBrokerService::GetInstance()->Init(resource_dispatcher_host_);
- return NaClBrokerService::GetInstance()->LaunchLoader(this,
- ASCIIToWide(channel_id()));
+ return NaClBrokerService::GetInstance()->LaunchLoader(
+ this, ASCIIToWide(channel_id()));
} else {
BrowserChildProcessHost::Launch(FilePath(), cmd_line);
}
@@ -198,7 +196,7 @@ void NaClProcessHost::OnProcessLaunched() {
DuplicateHandle(base::GetCurrentProcessHandle(),
reinterpret_cast<HANDLE>(
internal_->sockets_for_renderer[i]),
- render_message_filter_->peer_handle(),
+ chrome_render_message_filter_->peer_handle(),
&handle_in_renderer,
GENERIC_READ | GENERIC_WRITE,
FALSE,
@@ -219,7 +217,7 @@ void NaClProcessHost::OnProcessLaunched() {
// Copy the process handle into the renderer process.
DuplicateHandle(base::GetCurrentProcessHandle(),
handle(),
- render_message_filter_->peer_handle(),
+ chrome_render_message_filter_->peer_handle(),
&nacl_process_handle,
PROCESS_DUP_HANDLE,
FALSE,
@@ -234,8 +232,8 @@ void NaClProcessHost::OnProcessLaunched() {
ViewHostMsg_LaunchNaCl::WriteReplyParams(
reply_msg_, handles_for_renderer, nacl_process_handle, nacl_process_id);
- render_message_filter_->Send(reply_msg_);
- render_message_filter_ = NULL;
+ chrome_render_message_filter_->Send(reply_msg_);
+ chrome_render_message_filter_ = NULL;
reply_msg_ = NULL;
internal_->sockets_for_renderer.clear();
diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h
index b4deaea..3e36b63 100644
--- a/chrome/browser/nacl_host/nacl_process_host.h
+++ b/chrome/browser/nacl_host/nacl_process_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,11 +8,11 @@
#include "build/build_config.h"
-#include "base/ref_counted.h"
+#include "base/memory/ref_counted.h"
#include "chrome/common/nacl_types.h"
#include "content/browser/browser_child_process_host.h"
-class RenderMessageFilter;
+class ChromeRenderMessageFilter;
// Represents the browser side of the browser <--> NaCl communication
// channel. There will be one NaClProcessHost per NaCl process
@@ -22,12 +22,11 @@ class RenderMessageFilter;
// running in the renderer and NaCl processes.
class NaClProcessHost : public BrowserChildProcessHost {
public:
- NaClProcessHost(ResourceDispatcherHost *resource_dispatcher_host,
- const std::wstring& url);
+ explicit NaClProcessHost(const std::wstring& url);
~NaClProcessHost();
// Initialize the new NaCl process, returning true on success.
- bool Launch(RenderMessageFilter* render_message_filter,
+ bool Launch(ChromeRenderMessageFilter* chrome_render_message_filter,
int socket_count,
IPC::Message* reply_msg);
@@ -55,11 +54,9 @@ class NaClProcessHost : public BrowserChildProcessHost {
virtual bool CanShutdown();
private:
- ResourceDispatcherHost* resource_dispatcher_host_;
-
- // The RenderMessageFilter that requested this NaCl process. We use this
- // for sending the reply once the process has started.
- scoped_refptr<RenderMessageFilter> render_message_filter_;
+ // The ChromeRenderMessageFilter that requested this NaCl process. We use
+ // this for sending the reply once the process has started.
+ scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_;
// The reply message to send.
IPC::Message* reply_msg_;