| 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 "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 void* parent_handle = NULL; | 23 void* parent_handle = NULL; |
| 22 if (parent) { | 24 if (parent) { |
| 23 parent_decoder = parent->decoder_.get(); | 25 parent_decoder = parent->decoder_.get(); |
| 24 DCHECK(parent_decoder); | 26 DCHECK(parent_decoder); |
| 25 | 27 |
| 26 parent_context = parent_decoder->GetGLContext(); | 28 parent_context = parent_decoder->GetGLContext(); |
| 27 DCHECK(parent_context); | 29 DCHECK(parent_context); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); | 40 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); |
| 39 } | 41 } |
| 40 | 42 |
| 41 if (!context.get()) { | 43 if (!context.get()) { |
| 42 LOG(ERROR) << "GPUProcessor::Initialize failed"; | 44 LOG(ERROR) << "GPUProcessor::Initialize failed"; |
| 43 return false; | 45 return false; |
| 44 } | 46 } |
| 45 | 47 |
| 46 return InitializeCommon(context.release(), | 48 return InitializeCommon(context.release(), |
| 47 size, | 49 size, |
| 50 disallowed_extensions, |
| 48 allowed_extensions, | 51 allowed_extensions, |
| 49 attribs, | 52 attribs, |
| 50 parent_decoder, | 53 parent_decoder, |
| 51 parent_texture_id); | 54 parent_texture_id); |
| 52 } | 55 } |
| 53 | 56 |
| 54 void GPUProcessor::Destroy() { | 57 void GPUProcessor::Destroy() { |
| 55 DestroyCommon(); | 58 DestroyCommon(); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void GPUProcessor::WillSwapBuffers() { | 61 void GPUProcessor::WillSwapBuffers() { |
| 59 if (wrapped_swap_buffers_callback_.get()) { | 62 if (wrapped_swap_buffers_callback_.get()) { |
| 60 wrapped_swap_buffers_callback_->Run(); | 63 wrapped_swap_buffers_callback_->Run(); |
| 61 } | 64 } |
| 62 } | 65 } |
| 63 | 66 |
| 64 } // namespace gpu | 67 } // namespace gpu |
| OLD | NEW |