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

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 8572047: base::Bind() conversion for content/common/gpu and content/gpu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scoped_ptr<base::WPF> -> base::WPF 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 | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager.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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
11 #include "base/bind.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
13 #include "base/process_util.h" 14 #include "base/process_util.h"
14 #include "base/string_util.h" 15 #include "base/string_util.h"
15 #include "content/common/child_process.h" 16 #include "content/common/child_process.h"
16 #include "content/common/gpu/gpu_channel_manager.h" 17 #include "content/common/gpu/gpu_channel_manager.h"
17 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
18 #include "content/common/gpu/transport_texture.h" 19 #include "content/common/gpu/transport_texture.h"
19 #include "content/public/common/content_client.h" 20 #include "content/public/common/content_client.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
(...skipping 11 matching lines...) Expand all
32 : gpu_channel_manager_(gpu_channel_manager), 33 : gpu_channel_manager_(gpu_channel_manager),
33 renderer_id_(renderer_id), 34 renderer_id_(renderer_id),
34 renderer_process_(base::kNullProcessHandle), 35 renderer_process_(base::kNullProcessHandle),
35 renderer_pid_(base::kNullProcessId), 36 renderer_pid_(base::kNullProcessId),
36 share_group_(new gfx::GLShareGroup), 37 share_group_(new gfx::GLShareGroup),
37 watchdog_(watchdog), 38 watchdog_(watchdog),
38 software_(software), 39 software_(software),
39 handle_messages_scheduled_(false), 40 handle_messages_scheduled_(false),
40 processed_get_state_fast_(false), 41 processed_get_state_fast_(false),
41 num_contexts_preferring_discrete_gpu_(0), 42 num_contexts_preferring_discrete_gpu_(0),
42 task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 43 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
43 DCHECK(gpu_channel_manager); 44 DCHECK(gpu_channel_manager);
44 DCHECK(renderer_id); 45 DCHECK(renderer_id);
45 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 46 const CommandLine* command_line = CommandLine::ForCurrentProcess();
46 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 47 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
47 disallowed_features_.multisampling = 48 disallowed_features_.multisampling =
48 command_line->HasSwitch(switches::kDisableGLMultisampling); 49 command_line->HasSwitch(switches::kDisableGLMultisampling);
49 disallowed_features_.driver_bug_workarounds = 50 disallowed_features_.driver_bug_workarounds =
50 command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds); 51 command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds);
51 } 52 }
52 53
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void GpuChannel::OnScheduled() { 151 void GpuChannel::OnScheduled() {
151 if (handle_messages_scheduled_) 152 if (handle_messages_scheduled_)
152 return; 153 return;
153 // Post a task to handle any deferred messages. The deferred message queue is 154 // Post a task to handle any deferred messages. The deferred message queue is
154 // not emptied here, which ensures that OnMessageReceived will continue to 155 // not emptied here, which ensures that OnMessageReceived will continue to
155 // defer newly received messages until the ones in the queue have all been 156 // defer newly received messages until the ones in the queue have all been
156 // handled by HandleDeferredMessages. HandleDeferredMessages is invoked as a 157 // handled by HandleDeferredMessages. HandleDeferredMessages is invoked as a
157 // task to prevent reentrancy. 158 // task to prevent reentrancy.
158 MessageLoop::current()->PostTask( 159 MessageLoop::current()->PostTask(
159 FROM_HERE, 160 FROM_HERE,
160 task_factory_.NewRunnableMethod( 161 base::Bind(&GpuChannel::HandleMessage, weak_factory_.GetWeakPtr()));
161 &GpuChannel::HandleMessage));
162 handle_messages_scheduled_ = true; 162 handle_messages_scheduled_ = true;
163 } 163 }
164 164
165 void GpuChannel::LoseAllContexts() { 165 void GpuChannel::LoseAllContexts() {
166 gpu_channel_manager_->LoseAllContexts(); 166 gpu_channel_manager_->LoseAllContexts();
167 } 167 }
168 168
169 void GpuChannel::DestroySoon() { 169 void GpuChannel::DestroySoon() {
170 MessageLoop::current()->PostTask( 170 MessageLoop::current()->PostTask(
171 FROM_HERE, NewRunnableMethod(this, 171 FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this));
172 &GpuChannel::OnDestroy));
173 } 172 }
174 173
175 void GpuChannel::OnDestroy() { 174 void GpuChannel::OnDestroy() {
176 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); 175 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy");
177 gpu_channel_manager_->RemoveChannel(renderer_id_); 176 gpu_channel_manager_->RemoveChannel(renderer_id_);
178 } 177 }
179 178
180 void GpuChannel::CreateViewCommandBuffer( 179 void GpuChannel::CreateViewCommandBuffer(
181 gfx::PluginWindowHandle window, 180 gfx::PluginWindowHandle window,
182 int32 render_view_id, 181 int32 render_view_id,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 458
460 #if defined(OS_POSIX) 459 #if defined(OS_POSIX)
461 int GpuChannel::TakeRendererFileDescriptor() { 460 int GpuChannel::TakeRendererFileDescriptor() {
462 if (!channel_.get()) { 461 if (!channel_.get()) {
463 NOTREACHED(); 462 NOTREACHED();
464 return -1; 463 return -1;
465 } 464 }
466 return channel_->TakeClientFileDescriptor(); 465 return channel_->TakeClientFileDescriptor();
467 } 466 }
468 #endif // defined(OS_POSIX) 467 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698