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

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

Issue 8554001: base::Bind: Convert content/renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix. Created 9 years, 1 month 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
« no previous file with comments | « no previous file | content/renderer/gpu/transport_texture_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h"
7 #include "base/message_loop.h" 8 #include "base/message_loop.h"
8 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
9 #include "content/common/child_process.h" 10 #include "content/common/child_process.h"
10 #include "content/common/gpu/gpu_messages.h" 11 #include "content/common/gpu/gpu_messages.h"
11 #include "content/renderer/gpu/command_buffer_proxy.h" 12 #include "content/renderer/gpu/command_buffer_proxy.h"
12 #include "content/renderer/gpu/transport_texture_service.h" 13 #include "content/renderer/gpu/transport_texture_service.h"
13 #include "content/renderer/render_process.h" 14 #include "content/renderer/render_process.h"
14 #include "content/renderer/render_thread_impl.h" 15 #include "content/renderer/render_thread_impl.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 #include "ipc/ipc_sync_message_filter.h" 17 #include "ipc/ipc_sync_message_filter.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return false; 73 return false;
73 74
74 DCHECK(message.routing_id() != MSG_ROUTING_CONTROL); 75 DCHECK(message.routing_id() != MSG_ROUTING_CONTROL);
75 76
76 ListenerMap::iterator it = listeners_.find(message.routing_id()); 77 ListenerMap::iterator it = listeners_.find(message.routing_id());
77 78
78 if (it != listeners_.end()) { 79 if (it != listeners_.end()) {
79 const scoped_refptr<GpuChannelHost::Listener>& listener = it->second; 80 const scoped_refptr<GpuChannelHost::Listener>& listener = it->second;
80 listener->loop()->PostTask( 81 listener->loop()->PostTask(
81 FROM_HERE, 82 FROM_HERE,
82 NewRunnableMethod( 83 base::Bind(&GpuChannelHost::Listener::DispatchMessage, listener.get(),
83 listener.get(), 84 message));
84 &GpuChannelHost::Listener::DispatchMessage,
85 message));
86 } 85 }
87 86
88 return true; 87 return true;
89 } 88 }
90 89
91 void GpuChannelHost::MessageFilter::OnChannelError() { 90 void GpuChannelHost::MessageFilter::OnChannelError() {
92 DCHECK(MessageLoop::current() == ChildProcess::current()->io_message_loop()); 91 DCHECK(MessageLoop::current() == ChildProcess::current()->io_message_loop());
93 // Inform all the proxies that an error has occurred. This will be reported 92 // Inform all the proxies that an error has occurred. This will be reported
94 // via OpenGL as a lost context. 93 // via OpenGL as a lost context.
95 for (ListenerMap::iterator it = listeners_.begin(); 94 for (ListenerMap::iterator it = listeners_.begin();
96 it != listeners_.end(); 95 it != listeners_.end();
97 it++) { 96 it++) {
98 const scoped_refptr<GpuChannelHost::Listener>& listener = it->second; 97 const scoped_refptr<GpuChannelHost::Listener>& listener = it->second;
99 listener->loop()->PostTask( 98 listener->loop()->PostTask(
100 FROM_HERE, 99 FROM_HERE,
101 NewRunnableMethod( 100 base::Bind(&GpuChannelHost::Listener::DispatchError, listener.get()));
102 listener.get(),
103 &GpuChannelHost::Listener::DispatchError));
104 } 101 }
105 102
106 listeners_.clear(); 103 listeners_.clear();
107 104
108 ChildThread* main_thread = RenderProcess::current()->main_thread(); 105 ChildThread* main_thread = RenderProcess::current()->main_thread();
109 MessageLoop* main_loop = main_thread->message_loop(); 106 MessageLoop* main_loop = main_thread->message_loop();
110 main_loop->PostTask(FROM_HERE, 107 main_loop->PostTask(FROM_HERE,
111 NewRunnableMethod(parent_, 108 base::Bind(&GpuChannelHost::OnChannelError, parent_));
112 &GpuChannelHost::OnChannelError));
113 } 109 }
114 110
115 GpuChannelHost::GpuChannelHost() 111 GpuChannelHost::GpuChannelHost()
116 : state_(kUnconnected), 112 : state_(kUnconnected),
117 transport_texture_service_(new TransportTextureService()) { 113 transport_texture_service_(new TransportTextureService()) {
118 } 114 }
119 115
120 GpuChannelHost::~GpuChannelHost() { 116 GpuChannelHost::~GpuChannelHost() {
121 } 117 }
122 118
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 delete command_buffer; 301 delete command_buffer;
306 #endif 302 #endif
307 } 303 }
308 304
309 void GpuChannelHost::AddRoute( 305 void GpuChannelHost::AddRoute(
310 int route_id, base::WeakPtr<IPC::Channel::Listener> listener) { 306 int route_id, base::WeakPtr<IPC::Channel::Listener> listener) {
311 DCHECK(MessageLoopProxy::current()); 307 DCHECK(MessageLoopProxy::current());
312 308
313 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy(); 309 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy();
314 io_loop->PostTask(FROM_HERE, 310 io_loop->PostTask(FROM_HERE,
315 NewRunnableMethod( 311 base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
316 channel_filter_.get(), 312 channel_filter_.get(), route_id, listener,
317 &GpuChannelHost::MessageFilter::AddRoute, 313 MessageLoopProxy::current()));
318 route_id, listener, MessageLoopProxy::current()));
319 } 314 }
320 315
321 void GpuChannelHost::RemoveRoute(int route_id) { 316 void GpuChannelHost::RemoveRoute(int route_id) {
322 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy(); 317 MessageLoopProxy* io_loop = RenderProcess::current()->io_message_loop_proxy();
323 io_loop->PostTask(FROM_HERE, 318 io_loop->PostTask(FROM_HERE,
324 NewRunnableMethod( 319 base::Bind(&GpuChannelHost::MessageFilter::RemoveRoute,
325 channel_filter_.get(), 320 channel_filter_.get(), route_id));
326 &GpuChannelHost::MessageFilter::RemoveRoute,
327 route_id));
328 } 321 }
329 322
330 bool GpuChannelHost::WillGpuSwitchOccur( 323 bool GpuChannelHost::WillGpuSwitchOccur(
331 bool is_creating_context, gfx::GpuPreference gpu_preference) { 324 bool is_creating_context, gfx::GpuPreference gpu_preference) {
332 bool result = false; 325 bool result = false;
333 if (!Send(new GpuChannelMsg_WillGpuSwitchOccur(is_creating_context, 326 if (!Send(new GpuChannelMsg_WillGpuSwitchOccur(is_creating_context,
334 gpu_preference, 327 gpu_preference,
335 &result))) { 328 &result))) {
336 return false; 329 return false;
337 } 330 }
338 return result; 331 return result;
339 } 332 }
340 333
341 void GpuChannelHost::ForciblyCloseChannel() { 334 void GpuChannelHost::ForciblyCloseChannel() {
342 Send(new GpuChannelMsg_CloseChannel()); 335 Send(new GpuChannelMsg_CloseChannel());
343 SetStateLost(); 336 SetStateLost();
344 } 337 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/transport_texture_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698