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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/common/gpu/gpu_channel.h" | 12 #include "content/common/gpu/gpu_channel.h" |
13 #include "content/common/gpu/gpu_channel_manager.h" | 13 #include "content/common/gpu/gpu_channel_manager.h" |
14 #include "content/common/gpu/gpu_command_buffer_stub.h" | 14 #include "content/common/gpu/gpu_command_buffer_stub.h" |
15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
16 #include "content/common/gpu/gpu_watchdog.h" | 16 #include "content/common/gpu/gpu_watchdog.h" |
17 #include "gpu/command_buffer/common/constants.h" | 17 #include "gpu/command_buffer/common/constants.h" |
18 #include "ui/gfx/gl/gl_switches.h" | 18 #include "ui/gfx/gl/gl_switches.h" |
19 | 19 |
20 #if defined(TOUCH_UI) | 20 #if defined(TOUCH_UI) |
21 #include "content/common/gpu/image_transport_surface_linux.h" | 21 #include "content/common/gpu/image_transport_surface_linux.h" |
22 #endif | 22 #endif |
23 | 23 |
24 GpuCommandBufferStub::GpuCommandBufferStub( | 24 GpuCommandBufferStub::GpuCommandBufferStub( |
25 GpuChannel* channel, | 25 GpuChannel* channel, |
26 GpuCommandBufferStub* share_group, | 26 GpuCommandBufferStub* share_group, |
27 gfx::PluginWindowHandle handle, | 27 gfx::PluginWindowHandle handle, |
28 const gfx::Size& size, | 28 const gfx::Size& size, |
29 const gpu::gles2::DisallowedExtensions& disallowed_extensions, | 29 const gpu::gles2::DisallowedFeatures& disallowed_features, |
30 const std::string& allowed_extensions, | 30 const std::string& allowed_extensions, |
31 const std::vector<int32>& attribs, | 31 const std::vector<int32>& attribs, |
32 int32 route_id, | 32 int32 route_id, |
33 int32 renderer_id, | 33 int32 renderer_id, |
34 int32 render_view_id, | 34 int32 render_view_id, |
35 GpuWatchdog* watchdog, | 35 GpuWatchdog* watchdog, |
36 bool software) | 36 bool software) |
37 : channel_(channel), | 37 : channel_(channel), |
38 handle_(handle), | 38 handle_(handle), |
39 initial_size_(size), | 39 initial_size_(size), |
40 disallowed_extensions_(disallowed_extensions), | 40 disallowed_features_(disallowed_features), |
41 allowed_extensions_(allowed_extensions), | 41 allowed_extensions_(allowed_extensions), |
42 requested_attribs_(attribs), | 42 requested_attribs_(attribs), |
43 route_id_(route_id), | 43 route_id_(route_id), |
44 software_(software), | 44 software_(software), |
45 last_flush_count_(0), | 45 last_flush_count_(0), |
46 renderer_id_(renderer_id), | 46 renderer_id_(renderer_id), |
47 render_view_id_(render_view_id), | 47 render_view_id_(render_view_id), |
48 parent_stub_for_initialization_(), | 48 parent_stub_for_initialization_(), |
49 parent_texture_for_initialization_(0), | 49 parent_texture_for_initialization_(0), |
50 watchdog_(watchdog), | 50 watchdog_(watchdog), |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 OnInitializeFailed(reply_message); | 251 OnInitializeFailed(reply_message); |
252 return; | 252 return; |
253 } | 253 } |
254 } | 254 } |
255 #endif | 255 #endif |
256 | 256 |
257 // Initialize the decoder with either the view or pbuffer GLContext. | 257 // Initialize the decoder with either the view or pbuffer GLContext. |
258 if (!decoder_->Initialize(surface_.get(), | 258 if (!decoder_->Initialize(surface_.get(), |
259 context_.get(), | 259 context_.get(), |
260 initial_size_, | 260 initial_size_, |
261 disallowed_extensions_, | 261 disallowed_features_, |
262 allowed_extensions_.c_str(), | 262 allowed_extensions_.c_str(), |
263 requested_attribs_)) { | 263 requested_attribs_)) { |
264 LOG(ERROR) << "Failed to initialize decoder."; | 264 LOG(ERROR) << "Failed to initialize decoder."; |
265 OnInitializeFailed(reply_message); | 265 OnInitializeFailed(reply_message); |
266 return; | 266 return; |
267 } | 267 } |
268 | 268 |
269 if (CommandLine::ForCurrentProcess()->HasSwitch( | 269 if (CommandLine::ForCurrentProcess()->HasSwitch( |
270 switches::kEnableGPUServiceLogging)) { | 270 switches::kEnableGPUServiceLogging)) { |
271 decoder_->set_debug(true); | 271 decoder_->set_debug(true); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 channel_->AddRoute(decoder_route_id, decoder); | 640 channel_->AddRoute(decoder_route_id, decoder); |
641 decoder->Initialize(profile, reply_message); | 641 decoder->Initialize(profile, reply_message); |
642 } | 642 } |
643 | 643 |
644 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { | 644 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { |
645 channel_->RemoveRoute(decoder_route_id); | 645 channel_->RemoveRoute(decoder_route_id); |
646 video_decoders_.Remove(decoder_route_id); | 646 video_decoders_.Remove(decoder_route_id); |
647 } | 647 } |
648 | 648 |
649 #endif // defined(ENABLE_GPU) | 649 #endif // defined(ENABLE_GPU) |
OLD | NEW |