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

Unified Diff: chrome/browser/gpu_process_host_ui_shim.cc

Issue 6557006: Moved creation of GPU transfer buffers into the browser process.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
Index: chrome/browser/gpu_process_host_ui_shim.cc
===================================================================
--- chrome/browser/gpu_process_host_ui_shim.cc (revision 75655)
+++ chrome/browser/gpu_process_host_ui_shim.cc (working copy)
@@ -108,6 +108,7 @@
GpuProcessHostUIShim::GpuProcessHostUIShim()
: host_id_(++g_last_host_id),
+ gpu_process_(NULL),
gpu_feature_flags_set_(false) {
g_hosts_by_id.AddWithID(this, host_id_);
}
@@ -147,6 +148,18 @@
}
// static
+void GpuProcessHostUIShim::NotifyGpuProcessLaunched(
+ int host_id,
+ base::ProcessHandle gpu_process) {
+ DCHECK(gpu_process);
+
+ GpuProcessHostUIShim* ui_shim = FromID(host_id);
+ DCHECK(ui_shim);
+
+ ui_shim->gpu_process_ = gpu_process;
+}
+
+// static
GpuProcessHostUIShim* GpuProcessHostUIShim::FromID(int host_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (host_id == 0)
@@ -171,20 +184,25 @@
void EstablishChannelCallbackDispatcher(
GpuProcessHostUIShim::EstablishChannelCallback* callback,
const IPC::ChannelHandle& channel_handle,
+ base::ProcessHandle gpu_renderer_process,
const GPUInfo& gpu_info) {
scoped_ptr<GpuProcessHostUIShim::EstablishChannelCallback>
wrapped_callback(callback);
- wrapped_callback->Run(channel_handle, gpu_info);
+ wrapped_callback->Run(channel_handle, gpu_renderer_process, gpu_info);
}
void EstablishChannelError(
GpuProcessHostUIShim::EstablishChannelCallback* callback,
const IPC::ChannelHandle& channel_handle,
+ base::ProcessHandle gpu_renderer_process,
const GPUInfo& gpu_info) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableFunction(&EstablishChannelCallbackDispatcher,
- callback, channel_handle, gpu_info));
+ callback,
+ channel_handle,
+ gpu_renderer_process,
+ gpu_info));
}
void SynchronizeCallbackDispatcher(
@@ -225,7 +243,10 @@
while (!channel_requests_.empty()) {
linked_ptr<EstablishChannelCallback> callback = channel_requests_.front();
channel_requests_.pop();
- EstablishChannelError(callback.release(), IPC::ChannelHandle(), GPUInfo());
+ EstablishChannelError(callback.release(),
+ IPC::ChannelHandle(),
+ NULL,
+ GPUInfo());
}
// Now unblock all renderers waiting for synchronization replies.
@@ -246,14 +267,15 @@
}
void GpuProcessHostUIShim::EstablishGpuChannel(
- int renderer_id, EstablishChannelCallback *callback) {
+ int renderer_id,
+ EstablishChannelCallback *callback) {
DCHECK(CalledOnValidThread());
linked_ptr<EstablishChannelCallback> wrapped_callback(callback);
// If GPU features are already blacklisted, no need to establish the channel.
if (gpu_feature_flags_.flags() != 0) {
EstablishChannelError(
- wrapped_callback.release(), IPC::ChannelHandle(), GPUInfo());
+ wrapped_callback.release(), IPC::ChannelHandle(), NULL, GPUInfo());
return;
}
@@ -261,7 +283,7 @@
channel_requests_.push(wrapped_callback);
} else {
EstablishChannelError(
- wrapped_callback.release(), IPC::ChannelHandle(), GPUInfo());
+ wrapped_callback.release(), IPC::ChannelHandle(), NULL, GPUInfo());
}
}
@@ -340,6 +362,11 @@
GpuProcessHostUIShim::~GpuProcessHostUIShim() {
DCHECK(CalledOnValidThread());
g_hosts_by_id.Remove(host_id_);
+
+#if defined(OS_WIN)
+ if (gpu_process_)
+ CloseHandle(gpu_process_);
+#endif
}
bool GpuProcessHostUIShim::Init() {
@@ -390,6 +417,10 @@
void GpuProcessHostUIShim::OnChannelEstablished(
const IPC::ChannelHandle& channel_handle,
const GPUInfo& gpu_info) {
+ // The GPU process should have launched at this point and this object should
+ // have been notified of its process handle.
+ DCHECK(gpu_process_);
+
uint32 max_entry_id = gpu_blacklist_->max_entry_id();
// max_entry_id can be zero if we failed to load the GPU blacklist, don't
// bother with histograms then.
@@ -429,11 +460,15 @@
// GPU channel.
if (gpu_feature_flags_.flags() != 0) {
Send(new GpuMsg_CloseChannel(channel_handle));
- EstablishChannelError(callback.release(), IPC::ChannelHandle(), gpu_info);
+ EstablishChannelError(callback.release(),
+ IPC::ChannelHandle(),
+ NULL,
+ gpu_info);
AddCustomLogMessage(logging::LOG_WARNING, "WARNING", "GPU is blacklisted.");
- } else {
- callback->Run(channel_handle, gpu_info);
+ return;
}
+
+ callback->Run(channel_handle, gpu_process_, gpu_info);
}
void GpuProcessHostUIShim::OnSynchronizeReply() {

Powered by Google App Engine
This is Rietveld 408576698