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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 10071038: RefCounted types should not have public destructors, content/browser part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright bump Created 8 years, 8 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/common/gpu/gpu_channel.h ('k') | content/common/gpu/image_transport_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel.cc
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index 96c3553010c5a84133af5f625ad8c03200a06799..9785ce70ebae40a90f97171d8aa12e5fcb6f5e10 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -59,9 +59,37 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds);
}
-GpuChannel::~GpuChannel() {
+
+bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
+ base::WaitableEvent* shutdown_event) {
+ DCHECK(!channel_.get());
+
+ // Map renderer ID to a (single) channel to that process.
+ channel_.reset(new IPC::SyncChannel(
+ channel_id_,
+ IPC::Channel::MODE_SERVER,
+ this,
+ io_message_loop,
+ false,
+ shutdown_event));
+
+ return true;
}
+std::string GpuChannel::GetChannelName() {
+ return channel_id_;
+}
+
+#if defined(OS_POSIX)
+int GpuChannel::TakeRendererFileDescriptor() {
+ if (!channel_.get()) {
+ NOTREACHED();
+ return -1;
+ }
+ return channel_->TakeClientFileDescriptor();
+}
+#endif // defined(OS_POSIX)
+
bool GpuChannel::OnMessageReceived(const IPC::Message& message) {
if (log_messages_) {
DVLOG(1) << "received message @" << &message << " on channel @" << this
@@ -146,20 +174,6 @@ void GpuChannel::OnScheduled() {
handle_messages_scheduled_ = true;
}
-void GpuChannel::LoseAllContexts() {
- gpu_channel_manager_->LoseAllContexts();
-}
-
-void GpuChannel::DestroySoon() {
- MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this));
-}
-
-void GpuChannel::OnDestroy() {
- TRACE_EVENT0("gpu", "GpuChannel::OnDestroy");
- gpu_channel_manager_->RemoveChannel(client_id_);
-}
-
void GpuChannel::CreateViewCommandBuffer(
const gfx::GLSurfaceHandle& window,
int32 surface_id,
@@ -196,6 +210,39 @@ GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) {
return stubs_.Lookup(route_id);
}
+void GpuChannel::LoseAllContexts() {
+ gpu_channel_manager_->LoseAllContexts();
+}
+
+void GpuChannel::DestroySoon() {
+ MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this));
+}
+
+int GpuChannel::GenerateRouteID() {
+ static int last_id = 0;
+ return ++last_id;
+}
+
+void GpuChannel::AddRoute(int32 route_id, IPC::Channel::Listener* listener) {
+ router_.AddRoute(route_id, listener);
+}
+
+void GpuChannel::RemoveRoute(int32 route_id) {
+ router_.RemoveRoute(route_id);
+}
+
+bool GpuChannel::ShouldPreferDiscreteGpu() const {
+ return num_contexts_preferring_discrete_gpu_ > 0;
+}
+
+GpuChannel::~GpuChannel() {}
+
+void GpuChannel::OnDestroy() {
+ TRACE_EVENT0("gpu", "GpuChannel::OnDestroy");
+ gpu_channel_manager_->RemoveChannel(client_id_);
+}
+
bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
// Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
// here. This is so the reply can be delayed if the scheduler is unscheduled.
@@ -284,23 +331,6 @@ void GpuChannel::ScheduleDelayedWork(GpuCommandBufferStub *stub,
}
}
-int GpuChannel::GenerateRouteID() {
- static int last_id = 0;
- return ++last_id;
-}
-
-void GpuChannel::AddRoute(int32 route_id, IPC::Channel::Listener* listener) {
- router_.AddRoute(route_id, listener);
-}
-
-void GpuChannel::RemoveRoute(int32 route_id) {
- router_.RemoveRoute(route_id);
-}
-
-bool GpuChannel::ShouldPreferDiscreteGpu() const {
- return num_contexts_preferring_discrete_gpu_ > 0;
-}
-
void GpuChannel::OnCreateOffscreenCommandBuffer(
const gfx::Size& size,
const GPUCreateCommandBufferConfig& init_params,
@@ -391,22 +421,6 @@ void GpuChannel::OnCloseChannel() {
// At this point "this" is deleted!
}
-bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
- base::WaitableEvent* shutdown_event) {
- DCHECK(!channel_.get());
-
- // Map renderer ID to a (single) channel to that process.
- channel_.reset(new IPC::SyncChannel(
- channel_id_,
- IPC::Channel::MODE_SERVER,
- this,
- io_message_loop,
- false,
- shutdown_event));
-
- return true;
-}
-
void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) {
if (gpu_preference == gfx::PreferDiscreteGpu)
++num_contexts_preferring_discrete_gpu_;
@@ -417,17 +431,3 @@ void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) {
--num_contexts_preferring_discrete_gpu_;
DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0);
}
-
-std::string GpuChannel::GetChannelName() {
- return channel_id_;
-}
-
-#if defined(OS_POSIX)
-int GpuChannel::TakeRendererFileDescriptor() {
- if (!channel_.get()) {
- NOTREACHED();
- return -1;
- }
- return channel_->TakeClientFileDescriptor();
-}
-#endif // defined(OS_POSIX)
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/image_transport_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698