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

Side by Side Diff: content/renderer/gpu/gpu_channel_host.cc

Issue 8171015: Rename RenderThread to RenderThreadImpl (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/gpu/gpu_channel_host.h" 5 #include "content/renderer/gpu/gpu_channel_host.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "content/common/child_process.h" 9 #include "content/common/child_process.h"
10 #include "content/common/gpu/gpu_messages.h" 10 #include "content/common/gpu/gpu_messages.h"
11 #include "content/renderer/gpu/command_buffer_proxy.h" 11 #include "content/renderer/gpu/command_buffer_proxy.h"
12 #include "content/renderer/gpu/transport_texture_service.h" 12 #include "content/renderer/gpu/transport_texture_service.h"
13 #include "content/renderer/render_process.h" 13 #include "content/renderer/render_process.h"
14 #include "content/renderer/render_thread.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "ipc/ipc_sync_message_filter.h" 16 #include "ipc/ipc_sync_message_filter.h"
17 17
18 using base::AutoLock; 18 using base::AutoLock;
19 using base::MessageLoopProxy; 19 using base::MessageLoopProxy;
20 20
21 GpuChannelHost::Listener::Listener( 21 GpuChannelHost::Listener::Listener(
22 base::WeakPtr<IPC::Channel::Listener> listener, 22 base::WeakPtr<IPC::Channel::Listener> listener,
23 scoped_refptr<base::MessageLoopProxy> loop) 23 scoped_refptr<base::MessageLoopProxy> loop)
24 : listener_(listener), 24 : listener_(listener),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 : state_(kUnconnected), 116 : state_(kUnconnected),
117 transport_texture_service_(new TransportTextureService()) { 117 transport_texture_service_(new TransportTextureService()) {
118 } 118 }
119 119
120 GpuChannelHost::~GpuChannelHost() { 120 GpuChannelHost::~GpuChannelHost() {
121 } 121 }
122 122
123 void GpuChannelHost::Connect( 123 void GpuChannelHost::Connect(
124 const IPC::ChannelHandle& channel_handle, 124 const IPC::ChannelHandle& channel_handle,
125 base::ProcessHandle renderer_process_for_gpu) { 125 base::ProcessHandle renderer_process_for_gpu) {
126 DCHECK(RenderThread::current()); 126 DCHECK(RenderThreadImpl::current());
127 // Open a channel to the GPU process. We pass NULL as the main listener here 127 // Open a channel to the GPU process. We pass NULL as the main listener here
128 // since we need to filter everything to route it to the right thread. 128 // since we need to filter everything to route it to the right thread.
129 channel_.reset(new IPC::SyncChannel( 129 channel_.reset(new IPC::SyncChannel(
130 channel_handle, IPC::Channel::MODE_CLIENT, NULL, 130 channel_handle, IPC::Channel::MODE_CLIENT, NULL,
131 ChildProcess::current()->io_message_loop_proxy(), true, 131 ChildProcess::current()->io_message_loop_proxy(), true,
132 ChildProcess::current()->GetShutDownEvent())); 132 ChildProcess::current()->GetShutDownEvent()));
133 133
134 sync_filter_ = new IPC::SyncMessageFilter( 134 sync_filter_ = new IPC::SyncMessageFilter(
135 ChildProcess::current()->GetShutDownEvent()); 135 ChildProcess::current()->GetShutDownEvent());
136 136
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 bool GpuChannelHost::Send(IPC::Message* message) { 177 bool GpuChannelHost::Send(IPC::Message* message) {
178 // The GPU process never sends synchronous IPCs so clear the unblock flag to 178 // The GPU process never sends synchronous IPCs so clear the unblock flag to
179 // preserve order. 179 // preserve order.
180 message->set_unblock(false); 180 message->set_unblock(false);
181 181
182 // Currently we need to choose between two different mechanisms for sending. 182 // Currently we need to choose between two different mechanisms for sending.
183 // On the main thread we use the regular channel Send() method, on another 183 // On the main thread we use the regular channel Send() method, on another
184 // thread we use SyncMessageFilter. We also have to be careful interpreting 184 // thread we use SyncMessageFilter. We also have to be careful interpreting
185 // RenderThread::current() since it might return NULL during shutdown, while 185 // RenderThreadImpl::current() since it might return NULL during shutdown,
186 // we are actually calling from the main thread (discard message then). 186 // impl we are actually calling from the main thread (discard message then).
187 // 187 //
188 // TODO: Can we just always use sync_filter_ since we setup the channel 188 // TODO: Can we just always use sync_filter_ since we setup the channel
189 // without a main listener? 189 // without a main listener?
190 if (RenderThread::current()) { 190 if (RenderThreadImpl::current()) {
191 if (channel_.get()) 191 if (channel_.get())
192 return channel_->Send(message); 192 return channel_->Send(message);
193 } else if (MessageLoop::current()) { 193 } else if (MessageLoop::current()) {
194 return sync_filter_->Send(message); 194 return sync_filter_->Send(message);
195 } 195 }
196 196
197 // Callee takes ownership of message, regardless of whether Send is 197 // Callee takes ownership of message, regardless of whether Send is
198 // successful. See IPC::Message::Sender. 198 // successful. See IPC::Message::Sender.
199 delete message; 199 delete message;
200 return false; 200 return false;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 316
317 void GpuChannelHost::RemoveRoute(int route_id) { 317 void GpuChannelHost::RemoveRoute(int route_id) {
318 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy(); 318 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy();
319 io_loop->PostTask(FROM_HERE, 319 io_loop->PostTask(FROM_HERE,
320 NewRunnableMethod( 320 NewRunnableMethod(
321 channel_filter_.get(), 321 channel_filter_.get(),
322 &GpuChannelHost::MessageFilter::RemoveRoute, 322 &GpuChannelHost::MessageFilter::RemoveRoute,
323 route_id)); 323 route_id));
324 } 324 }
OLDNEW
« no previous file with comments | « content/renderer/gpu/command_buffer_proxy.cc ('k') | content/renderer/gpu/gpu_video_decode_accelerator_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698