OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/process_util.h" | 7 #include "base/process_util.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/gpu/gpu_channel.h" | 10 #include "chrome/gpu/gpu_channel.h" |
11 #include "chrome/gpu/gpu_command_buffer_stub.h" | 11 #include "chrome/gpu/gpu_command_buffer_stub.h" |
12 #include "chrome/gpu/gpu_thread.h" | 12 #include "chrome/gpu/gpu_thread.h" |
13 #include "content/common/child_thread.h" | 13 #include "content/common/child_thread.h" |
14 #include "content/common/gpu_messages.h" | 14 #include "content/common/gpu_messages.h" |
15 | 15 |
16 using gpu::Buffer; | 16 using gpu::Buffer; |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #define kCompositorWindowOwner L"CompositorWindowOwner" | 19 #define kCompositorWindowOwner L"CompositorWindowOwner" |
20 #endif // defined(OS_WIN) | 20 #endif // defined(OS_WIN) |
21 | 21 |
22 GpuCommandBufferStub::GpuCommandBufferStub( | 22 GpuCommandBufferStub::GpuCommandBufferStub( |
23 GpuChannel* channel, | 23 GpuChannel* channel, |
24 gfx::PluginWindowHandle handle, | 24 gfx::PluginWindowHandle handle, |
25 GpuCommandBufferStub* parent, | 25 GpuCommandBufferStub* parent, |
26 const gfx::Size& size, | 26 const gfx::Size& size, |
| 27 const gpu::gles2::DisallowedExtensions& disallowed_extensions, |
27 const std::string& allowed_extensions, | 28 const std::string& allowed_extensions, |
28 const std::vector<int32>& attribs, | 29 const std::vector<int32>& attribs, |
29 uint32 parent_texture_id, | 30 uint32 parent_texture_id, |
30 int32 route_id, | 31 int32 route_id, |
31 int32 renderer_id, | 32 int32 renderer_id, |
32 int32 render_view_id) | 33 int32 render_view_id) |
33 : channel_(channel), | 34 : channel_(channel), |
34 handle_(handle), | 35 handle_(handle), |
35 parent_( | 36 parent_( |
36 parent ? parent->AsWeakPtr() : base::WeakPtr<GpuCommandBufferStub>()), | 37 parent ? parent->AsWeakPtr() : base::WeakPtr<GpuCommandBufferStub>()), |
37 initial_size_(size), | 38 initial_size_(size), |
| 39 disallowed_extensions_(disallowed_extensions), |
38 allowed_extensions_(allowed_extensions), | 40 allowed_extensions_(allowed_extensions), |
39 requested_attribs_(attribs), | 41 requested_attribs_(attribs), |
40 parent_texture_id_(parent_texture_id), | 42 parent_texture_id_(parent_texture_id), |
41 route_id_(route_id), | 43 route_id_(route_id), |
42 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
43 compositor_window_(NULL), | 45 compositor_window_(NULL), |
44 #endif // defined(OS_WIN) | 46 #endif // defined(OS_WIN) |
45 renderer_id_(renderer_id), | 47 renderer_id_(renderer_id), |
46 render_view_id_(render_view_id) { | 48 render_view_id_(render_view_id) { |
47 } | 49 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 #endif | 231 #endif |
230 | 232 |
231 // Initialize the CommandBufferService and GPUProcessor. | 233 // Initialize the CommandBufferService and GPUProcessor. |
232 if (command_buffer_->Initialize(&shared_memory, size)) { | 234 if (command_buffer_->Initialize(&shared_memory, size)) { |
233 gpu::GPUProcessor* parent_processor = | 235 gpu::GPUProcessor* parent_processor = |
234 parent_ ? parent_->processor_.get() : NULL; | 236 parent_ ? parent_->processor_.get() : NULL; |
235 processor_.reset(new gpu::GPUProcessor(command_buffer_.get(), NULL)); | 237 processor_.reset(new gpu::GPUProcessor(command_buffer_.get(), NULL)); |
236 if (processor_->Initialize( | 238 if (processor_->Initialize( |
237 output_window_handle, | 239 output_window_handle, |
238 initial_size_, | 240 initial_size_, |
| 241 disallowed_extensions_, |
239 allowed_extensions_.c_str(), | 242 allowed_extensions_.c_str(), |
240 requested_attribs_, | 243 requested_attribs_, |
241 parent_processor, | 244 parent_processor, |
242 parent_texture_id_)) { | 245 parent_texture_id_)) { |
243 command_buffer_->SetPutOffsetChangeCallback( | 246 command_buffer_->SetPutOffsetChangeCallback( |
244 NewCallback(processor_.get(), | 247 NewCallback(processor_.get(), |
245 &gpu::GPUProcessor::ProcessCommands)); | 248 &gpu::GPUProcessor::ProcessCommands)); |
246 processor_->SetSwapBuffersCallback( | 249 processor_->SetSwapBuffersCallback( |
247 NewCallback(this, &GpuCommandBufferStub::OnSwapBuffers)); | 250 NewCallback(this, &GpuCommandBufferStub::OnSwapBuffers)); |
248 | 251 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 #elif defined(OS_WIN) | 410 #elif defined(OS_WIN) |
408 HWND hwnd = static_cast<HWND>(compositor_window_); | 411 HWND hwnd = static_cast<HWND>(compositor_window_); |
409 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 412 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
410 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 413 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
411 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); | 414 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
412 #endif // defined(OS_LINUX) | 415 #endif // defined(OS_LINUX) |
413 } | 416 } |
414 } | 417 } |
415 | 418 |
416 #endif // defined(ENABLE_GPU) | 419 #endif // defined(ENABLE_GPU) |
OLD | NEW |