OLD | NEW |
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(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
10 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "content/common/gpu/gpu_channel.h" | 13 #include "content/common/gpu/gpu_channel.h" |
13 #include "content/common/gpu/gpu_channel_manager.h" | 14 #include "content/common/gpu/gpu_channel_manager.h" |
14 #include "content/common/gpu/gpu_command_buffer_stub.h" | 15 #include "content/common/gpu/gpu_command_buffer_stub.h" |
15 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
16 #include "content/common/gpu/gpu_watchdog.h" | 17 #include "content/common/gpu/gpu_watchdog.h" |
17 #include "gpu/command_buffer/common/constants.h" | 18 #include "gpu/command_buffer/common/constants.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 240 } |
240 | 241 |
241 if (CommandLine::ForCurrentProcess()->HasSwitch( | 242 if (CommandLine::ForCurrentProcess()->HasSwitch( |
242 switches::kEnableGPUServiceLogging)) { | 243 switches::kEnableGPUServiceLogging)) { |
243 decoder_->set_debug(true); | 244 decoder_->set_debug(true); |
244 } | 245 } |
245 | 246 |
246 SetSwapInterval(); | 247 SetSwapInterval(); |
247 | 248 |
248 command_buffer_->SetPutOffsetChangeCallback( | 249 command_buffer_->SetPutOffsetChangeCallback( |
249 NewCallback(scheduler_.get(), | 250 base::Bind(&gpu::GpuScheduler::PutChanged, |
250 &gpu::GpuScheduler::PutChanged)); | 251 base::Unretained(scheduler_.get()))); |
251 command_buffer_->SetParseErrorCallback( | 252 command_buffer_->SetParseErrorCallback( |
252 NewCallback(this, &GpuCommandBufferStub::OnParseError)); | 253 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); |
253 scheduler_->SetScheduledCallback( | 254 scheduler_->SetScheduledCallback( |
254 NewCallback(channel_, &GpuChannel::OnScheduled)); | 255 base::Bind(&GpuChannel::OnScheduled, base::Unretained(channel_))); |
255 | 256 |
256 // On platforms that use an ImageTransportSurface, the surface | 257 // On platforms that use an ImageTransportSurface, the surface |
257 // handles co-ordinating the resize with the browser process. The | 258 // handles co-ordinating the resize with the browser process. The |
258 // surface sets it's own resize callback, so we shouldn't do it here. | 259 // surface sets it's own resize callback, so we shouldn't do it here. |
259 #if !defined(OS_MACOSX) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 260 #if !defined(OS_MACOSX) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
260 if (handle_ != gfx::kNullPluginWindow) { | 261 if (handle_ != gfx::kNullPluginWindow) { |
261 decoder_->SetResizeCallback( | 262 decoder_->SetResizeCallback( |
262 NewCallback(this, &GpuCommandBufferStub::OnResize)); | 263 base::Bind(&GpuCommandBufferStub::OnResize, base::Unretained(this))); |
263 } | 264 } |
264 #endif | 265 #endif |
265 | 266 |
266 if (watchdog_) { | 267 if (watchdog_) { |
267 scheduler_->SetCommandProcessedCallback( | 268 scheduler_->SetCommandProcessedCallback( |
268 NewCallback(this, &GpuCommandBufferStub::OnCommandProcessed)); | 269 base::Bind(&GpuCommandBufferStub::OnCommandProcessed, |
| 270 base::Unretained(this))); |
269 } | 271 } |
270 | 272 |
271 if (parent_stub_for_initialization_) { | 273 if (parent_stub_for_initialization_) { |
272 decoder_->SetParent(parent_stub_for_initialization_->decoder_.get(), | 274 decoder_->SetParent(parent_stub_for_initialization_->decoder_.get(), |
273 parent_texture_for_initialization_); | 275 parent_texture_for_initialization_); |
274 parent_stub_for_initialization_.reset(); | 276 parent_stub_for_initialization_.reset(); |
275 parent_texture_for_initialization_ = 0; | 277 parent_texture_for_initialization_ = 0; |
276 } | 278 } |
277 | 279 |
278 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); | 280 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { | 514 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { |
513 channel_->RemoveRoute(decoder_route_id); | 515 channel_->RemoveRoute(decoder_route_id); |
514 video_decoders_.Remove(decoder_route_id); | 516 video_decoders_.Remove(decoder_route_id); |
515 } | 517 } |
516 | 518 |
517 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 519 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
518 surface_->SetVisible(visible); | 520 surface_->SetVisible(visible); |
519 } | 521 } |
520 | 522 |
521 #endif // defined(ENABLE_GPU) | 523 #endif // defined(ENABLE_GPU) |
OLD | NEW |