summaryrefslogtreecommitdiffstats
path: root/chrome/gpu/gpu_thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/gpu/gpu_thread.cc')
-rw-r--r--chrome/gpu/gpu_thread.cc62
1 files changed, 27 insertions, 35 deletions
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index 6116b48..9dc57d8 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -12,7 +12,6 @@
#include "build/build_config.h"
#include "chrome/common/child_process.h"
#include "chrome/common/child_process_logging.h"
-#include "chrome/common/gpu_info.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/gpu/gpu_info_collector.h"
#include "ipc/ipc_channel_handle.h"
@@ -41,6 +40,15 @@ GpuThread::GpuThread() {
GpuThread::~GpuThread() {
}
+void GpuThread::Init(const base::Time& process_start_time) {
+ gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
+ child_process_logging::SetGpuInfo(gpu_info_);
+
+ // Record initialization only after collecting the GPU info because that can
+ // take a significant amount of time.
+ gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time);
+}
+
void GpuThread::RemoveChannel(int renderer_id) {
gpu_channels_.erase(renderer_id);
}
@@ -66,39 +74,30 @@ void GpuThread::OnEstablishChannel(int renderer_id) {
IPC::ChannelHandle channel_handle;
GPUInfo gpu_info;
- // Fail to establish a channel if some implementation of GL cannot be
- // initialized.
- if (gfx::GLContext::InitializeOneOff()) {
- if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info))
- LOG(WARNING) << "Could not collect GPU info.";
-
- child_process_logging::SetGpuInfo(gpu_info);
- GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
+ GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
+ if (iter == gpu_channels_.end())
+ channel = new GpuChannel(renderer_id);
+ else
+ channel = iter->second;
- if (iter == gpu_channels_.end())
- channel = new GpuChannel(renderer_id);
- else
- channel = iter->second;
+ DCHECK(channel != NULL);
- DCHECK(channel != NULL);
+ if (channel->Init())
+ gpu_channels_[renderer_id] = channel;
+ else
+ channel = NULL;
- if (channel->Init())
- gpu_channels_[renderer_id] = channel;
- else
- channel = NULL;
-
- if (channel.get()) {
- channel_handle.name = channel->GetChannelName();
+ if (channel.get()) {
+ channel_handle.name = channel->GetChannelName();
#if defined(OS_POSIX)
- // On POSIX, pass the renderer-side FD. Also mark it as auto-close so
- // that it gets closed after it has been sent.
- int renderer_fd = channel->DisownRendererFd();
- channel_handle.socket = base::FileDescriptor(renderer_fd, true);
+ // On POSIX, pass the renderer-side FD. Also mark it as auto-close so
+ // that it gets closed after it has been sent.
+ int renderer_fd = channel->DisownRendererFd();
+ channel_handle.socket = base::FileDescriptor(renderer_fd, true);
#endif
- }
}
- Send(new GpuHostMsg_ChannelEstablished(channel_handle, gpu_info));
+ Send(new GpuHostMsg_ChannelEstablished(channel_handle, gpu_info_));
}
void GpuThread::OnSynchronize() {
@@ -106,14 +105,7 @@ void GpuThread::OnSynchronize() {
}
void GpuThread::OnCollectGraphicsInfo() {
- // Fail to establish a channel if some implementation of GL cannot be
- // initialized.
- GPUInfo gpu_info;
- if (gfx::GLContext::InitializeOneOff()) {
- gpu_info_collector::CollectGraphicsInfo(&gpu_info);
- }
-
- Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info));
+ Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
}
void GpuThread::OnCrash() {