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 #include "app/gfx/gl/gl_context.h" | 5 #include "app/gfx/gl/gl_context.h" |
6 #include "gpu/command_buffer/service/gpu_processor.h" | 6 #include "gpu/command_buffer/service/gpu_processor.h" |
7 | 7 |
8 using ::base::SharedMemory; | 8 using ::base::SharedMemory; |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 | 11 |
12 bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, | 12 bool GPUProcessor::Initialize( |
13 const gfx::Size& size, | 13 gfx::PluginWindowHandle window, |
14 const char* allowed_extensions, | 14 const gfx::Size& size, |
15 const std::vector<int32>& attribs, | 15 const gles2::DisallowedExtensions& disallowed_extensions, |
16 GPUProcessor* parent, | 16 const char* allowed_extensions, |
17 uint32 parent_texture_id) { | 17 const std::vector<int32>& attribs, |
| 18 GPUProcessor* parent, |
| 19 uint32 parent_texture_id) { |
18 // Get the parent decoder and the GLContext to share IDs with, if any. | 20 // Get the parent decoder and the GLContext to share IDs with, if any. |
19 gles2::GLES2Decoder* parent_decoder = NULL; | 21 gles2::GLES2Decoder* parent_decoder = NULL; |
20 gfx::GLContext* parent_context = NULL; | 22 gfx::GLContext* parent_context = NULL; |
21 if (parent) { | 23 if (parent) { |
22 parent_decoder = parent->decoder_.get(); | 24 parent_decoder = parent->decoder_.get(); |
23 DCHECK(parent_decoder); | 25 DCHECK(parent_decoder); |
24 | 26 |
25 parent_context = parent_decoder->GetGLContext(); | 27 parent_context = parent_decoder->GetGLContext(); |
26 DCHECK(parent_context); | 28 DCHECK(parent_context); |
27 } | 29 } |
(...skipping 18 matching lines...) Expand all Loading... |
46 if (!surface_->Initialize(context.get(), false)) { | 48 if (!surface_->Initialize(context.get(), false)) { |
47 LOG(ERROR) << "GPUProcessor::Initialize failed to " | 49 LOG(ERROR) << "GPUProcessor::Initialize failed to " |
48 << "initialize AcceleratedSurface."; | 50 << "initialize AcceleratedSurface."; |
49 Destroy(); | 51 Destroy(); |
50 return false; | 52 return false; |
51 } | 53 } |
52 } | 54 } |
53 | 55 |
54 return InitializeCommon(context.release(), | 56 return InitializeCommon(context.release(), |
55 size, | 57 size, |
| 58 disallowed_extensions, |
56 allowed_extensions, | 59 allowed_extensions, |
57 attribs, | 60 attribs, |
58 parent_decoder, | 61 parent_decoder, |
59 parent_texture_id); | 62 parent_texture_id); |
60 } | 63 } |
61 | 64 |
62 void GPUProcessor::Destroy() { | 65 void GPUProcessor::Destroy() { |
63 if (surface_.get()) { | 66 if (surface_.get()) { |
64 surface_->Destroy(); | 67 surface_->Destroy(); |
65 surface_.reset(); | 68 surface_.reset(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (surface_.get()) { | 133 if (surface_.get()) { |
131 surface_->SwapBuffers(); | 134 surface_->SwapBuffers(); |
132 } | 135 } |
133 | 136 |
134 if (wrapped_swap_buffers_callback_.get()) { | 137 if (wrapped_swap_buffers_callback_.get()) { |
135 wrapped_swap_buffers_callback_->Run(); | 138 wrapped_swap_buffers_callback_->Run(); |
136 } | 139 } |
137 } | 140 } |
138 | 141 |
139 } // namespace gpu | 142 } // namespace gpu |
OLD | NEW |