Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/posix/eintr_wrapper.h" | 13 #include "base/posix/eintr_wrapper.h" |
| 14 #include "base/power_monitor/power_monitor.h" | |
| 14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 16 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 16 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
| 18 #include "content/common/power_monitor_service.h" | |
| 17 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 18 #include "gpu/command_buffer/common/mailbox.h" | 20 #include "gpu/command_buffer/common/mailbox.h" |
| 19 #include "ipc/ipc_sync_message_filter.h" | 21 #include "ipc/ipc_sync_message_filter.h" |
| 20 | 22 |
| 21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 22 #include "content/public/common/sandbox_init.h" | 24 #include "content/public/common/sandbox_init.h" |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 using base::AutoLock; | 27 using base::AutoLock; |
| 26 using base::MessageLoopProxy; | 28 using base::MessageLoopProxy; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 45 return host; | 47 return host; |
| 46 } | 48 } |
| 47 | 49 |
| 48 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, | 50 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, |
| 49 int gpu_host_id, | 51 int gpu_host_id, |
| 50 int client_id, | 52 int client_id, |
| 51 const gpu::GPUInfo& gpu_info) | 53 const gpu::GPUInfo& gpu_info) |
| 52 : factory_(factory), | 54 : factory_(factory), |
| 53 client_id_(client_id), | 55 client_id_(client_id), |
| 54 gpu_host_id_(gpu_host_id), | 56 gpu_host_id_(gpu_host_id), |
| 55 gpu_info_(gpu_info) { | 57 gpu_info_(gpu_info), |
| 58 power_monitor_service_(new PowerMonitorService(this)) { | |
| 56 next_transfer_buffer_id_.GetNext(); | 59 next_transfer_buffer_id_.GetNext(); |
| 60 | |
| 61 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | |
| 62 if (power_monitor) | |
| 63 power_monitor->AddObserver(power_monitor_service_.get()); | |
|
Ken Russell (switch to Gerrit)
2013/06/24 22:54:38
Unless I'm misremembering and misreading the code,
| |
| 57 } | 64 } |
| 58 | 65 |
| 59 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) { | 66 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) { |
| 60 // Open a channel to the GPU process. We pass NULL as the main listener here | 67 // Open a channel to the GPU process. We pass NULL as the main listener here |
| 61 // since we need to filter everything to route it to the right thread. | 68 // since we need to filter everything to route it to the right thread. |
| 62 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); | 69 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); |
| 63 channel_.reset(new IPC::SyncChannel(channel_handle, | 70 channel_.reset(new IPC::SyncChannel(channel_handle, |
| 64 IPC::Channel::MODE_CLIENT, | 71 IPC::Channel::MODE_CLIENT, |
| 65 NULL, | 72 NULL, |
| 66 io_loop.get(), | 73 io_loop.get(), |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 AutoLock lock(lock_); | 403 AutoLock lock(lock_); |
| 397 DCHECK_LE(names.size(), requested_mailboxes_); | 404 DCHECK_LE(names.size(), requested_mailboxes_); |
| 398 requested_mailboxes_ -= names.size(); | 405 requested_mailboxes_ -= names.size(); |
| 399 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 406 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
| 400 names.begin(), | 407 names.begin(), |
| 401 names.end()); | 408 names.end()); |
| 402 } | 409 } |
| 403 | 410 |
| 404 | 411 |
| 405 } // namespace content | 412 } // namespace content |
| OLD | NEW |