Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/plugin_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_process_host.cc
===================================================================
--- content/browser/gpu/gpu_process_host.cc (revision 118420)
+++ content/browser/gpu/gpu_process_host.cc (working copy)
@@ -15,6 +15,7 @@
#include "base/process_util.h"
#include "base/string_piece.h"
#include "base/threading/thread.h"
+#include "content/browser/browser_child_process_host.h"
#include "content/browser/gpu/gpu_data_manager.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/renderer_host/render_widget_host.h"
@@ -160,12 +161,13 @@
DISALLOW_COPY_AND_ASSIGN(GpuMainThread);
};
-static bool HostIsValid(GpuProcessHost* host) {
+// static
+bool GpuProcessHost::HostIsValid(GpuProcessHost* host) {
if (!host)
return false;
// Check if the GPU process has died and the host is about to be destroyed.
- if (host->disconnect_was_alive())
+ if (host->process_->disconnect_was_alive())
return false;
// The Gpu process is invalid if it's not using software, the card is
@@ -245,8 +247,7 @@
}
GpuProcessHost::GpuProcessHost(int host_id)
- : BrowserChildProcessHost(content::PROCESS_TYPE_GPU),
- host_id_(host_id),
+ : host_id_(host_id),
gpu_process_(base::kNullProcessHandle),
in_process_(false),
software_rendering_(false) {
@@ -269,6 +270,8 @@
BrowserThread::UI,
FROM_HERE,
base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id));
+
+ process_.reset(new BrowserChildProcessHost(content::PROCESS_TYPE_GPU, this));
}
GpuProcessHost::~GpuProcessHost() {
@@ -280,7 +283,7 @@
GPU_PROCESS_LIFETIME_EVENT_MAX);
int exit_code;
- base::TerminationStatus status = GetChildTerminationStatus(&exit_code);
+ base::TerminationStatus status = process_->GetTerminationStatus(&exit_code);
UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus",
status,
base::TERMINATION_STATUS_MAX_ENUM);
@@ -311,7 +314,7 @@
}
bool GpuProcessHost::Init() {
- std::string channel_id = child_process_host()->CreateChannel();
+ std::string channel_id = process_->GetHost()->CreateChannel();
if (channel_id.empty())
return false;
@@ -350,12 +353,12 @@
bool GpuProcessHost::Send(IPC::Message* msg) {
DCHECK(CalledOnValidThread());
- if (child_process_host()->IsChannelOpening()) {
+ if (process_->GetHost()->IsChannelOpening()) {
queued_messages_.push(msg);
return true;
}
- return BrowserChildProcessHost::Send(msg);
+ return process_->Send(msg);
}
bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
@@ -371,7 +374,6 @@
}
void GpuProcessHost::OnChannelConnected(int32 peer_pid) {
- BrowserChildProcessHost::OnChannelConnected(peer_pid);
while (!queued_messages_.empty()) {
Send(queued_messages_.front());
queued_messages_.pop();
@@ -489,7 +491,7 @@
// to such requests require that the GPU process handle be known.
base::ProcessHandle child_handle = in_process_ ?
- base::GetCurrentProcessHandle() : data().handle;
+ base::GetCurrentProcessHandle() : process_->GetData().handle;
#if defined(OS_WIN)
DuplicateHandle(base::GetCurrentProcessHandle(),
@@ -510,7 +512,6 @@
// The gpu process is too unstable to use. Disable it for current session.
gpu_enabled_ = false;
}
- BrowserChildProcessHost::OnProcessCrashed(exit_code);
}
bool GpuProcessHost::software_rendering() {
@@ -519,7 +520,7 @@
void GpuProcessHost::ForceShutdown() {
g_hosts_by_id.Pointer()->Remove(host_id_);
- BrowserChildProcessHost::ForceShutdown();
+ process_->ForceShutdown();
}
bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
@@ -589,7 +590,7 @@
if (!gpu_launcher.empty())
cmd_line->PrependWrapper(gpu_launcher);
- Launch(
+ process_->Launch(
#if defined(OS_WIN)
FilePath(),
#elif defined(OS_POSIX)
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/plugin_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698