OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "app/gfx/gl/gl_context.h" | 7 #include "app/gfx/gl/gl_context.h" |
8 #include "gpu/command_buffer/service/gpu_processor.h" | 8 #include "gpu/command_buffer/service/gpu_processor.h" |
9 | 9 |
10 using ::base::SharedMemory; | 10 using ::base::SharedMemory; |
11 | 11 |
12 namespace gpu { | 12 namespace gpu { |
13 | 13 |
14 bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, | 14 bool GPUProcessor::Initialize( |
15 const gfx::Size& size, | 15 gfx::PluginWindowHandle window, |
16 const char* allowed_extensions, | 16 const gfx::Size& size, |
17 const std::vector<int32>& attribs, | 17 const gles2::DisallowedExtensions& disallowed_extensions, |
18 GPUProcessor* parent, | 18 const char* allowed_extensions, |
19 uint32 parent_texture_id) { | 19 const std::vector<int32>& attribs, |
| 20 GPUProcessor* parent, |
| 21 uint32 parent_texture_id) { |
20 // Get the parent decoder and the GLContext to share IDs with, if any. | 22 // Get the parent decoder and the GLContext to share IDs with, if any. |
21 gles2::GLES2Decoder* parent_decoder = NULL; | 23 gles2::GLES2Decoder* parent_decoder = NULL; |
22 gfx::GLContext* parent_context = NULL; | 24 gfx::GLContext* parent_context = NULL; |
23 if (parent) { | 25 if (parent) { |
24 parent_decoder = parent->decoder_.get(); | 26 parent_decoder = parent->decoder_.get(); |
25 DCHECK(parent_decoder); | 27 DCHECK(parent_decoder); |
26 | 28 |
27 parent_context = parent_decoder->GetGLContext(); | 29 parent_context = parent_decoder->GetGLContext(); |
28 DCHECK(parent_context); | 30 DCHECK(parent_context); |
29 } | 31 } |
30 | 32 |
31 // Create either a view or pbuffer based GLContext. | 33 // Create either a view or pbuffer based GLContext. |
32 scoped_ptr<gfx::GLContext> context; | 34 scoped_ptr<gfx::GLContext> context; |
33 if (window) { | 35 if (window) { |
34 DCHECK(!parent_context); | 36 DCHECK(!parent_context); |
35 | 37 |
36 // TODO(apatrick): support multisampling. | 38 // TODO(apatrick): support multisampling. |
37 context.reset(gfx::GLContext::CreateViewGLContext(window, false)); | 39 context.reset(gfx::GLContext::CreateViewGLContext(window, false)); |
38 } else { | 40 } else { |
39 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); | 41 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); |
40 } | 42 } |
41 | 43 |
42 if (!context.get()) | 44 if (!context.get()) |
43 return false; | 45 return false; |
44 | 46 |
45 return InitializeCommon(context.release(), | 47 return InitializeCommon(context.release(), |
46 size, | 48 size, |
| 49 disallowed_extensions, |
47 allowed_extensions, | 50 allowed_extensions, |
48 attribs, | 51 attribs, |
49 parent_decoder, | 52 parent_decoder, |
50 parent_texture_id); | 53 parent_texture_id); |
51 } | 54 } |
52 | 55 |
53 void GPUProcessor::Destroy() { | 56 void GPUProcessor::Destroy() { |
54 DestroyCommon(); | 57 DestroyCommon(); |
55 } | 58 } |
56 | 59 |
57 void GPUProcessor::WillSwapBuffers() { | 60 void GPUProcessor::WillSwapBuffers() { |
58 if (wrapped_swap_buffers_callback_.get()) { | 61 if (wrapped_swap_buffers_callback_.get()) { |
59 wrapped_swap_buffers_callback_->Run(); | 62 wrapped_swap_buffers_callback_->Run(); |
60 } | 63 } |
61 } | 64 } |
62 | 65 |
63 } // namespace gpu | 66 } // namespace gpu |
OLD | NEW |