| 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(gfx::PluginWindowHandle window, |
| 13 const gfx::Size& size, | 13 const gfx::Size& size, |
| 14 const gles2::DisallowedExtensions& disallowed, |
| 14 const char* allowed_extensions, | 15 const char* allowed_extensions, |
| 15 const std::vector<int32>& attribs, | 16 const std::vector<int32>& attribs, |
| 16 GPUProcessor* parent, | 17 GPUProcessor* parent, |
| 17 uint32 parent_texture_id) { | 18 uint32 parent_texture_id) { |
| 18 // Get the parent decoder and the GLContext to share IDs with, if any. | 19 // Get the parent decoder and the GLContext to share IDs with, if any. |
| 19 gles2::GLES2Decoder* parent_decoder = NULL; | 20 gles2::GLES2Decoder* parent_decoder = NULL; |
| 20 gfx::GLContext* parent_context = NULL; | 21 gfx::GLContext* parent_context = NULL; |
| 21 void* parent_handle = NULL; | 22 void* parent_handle = NULL; |
| 22 if (parent) { | 23 if (parent) { |
| 23 parent_decoder = parent->decoder_.get(); | 24 parent_decoder = parent->decoder_.get(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); | 39 context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 if (!context.get()) { | 42 if (!context.get()) { |
| 42 LOG(ERROR) << "GPUProcessor::Initialize failed"; | 43 LOG(ERROR) << "GPUProcessor::Initialize failed"; |
| 43 return false; | 44 return false; |
| 44 } | 45 } |
| 45 | 46 |
| 46 return InitializeCommon(context.release(), | 47 return InitializeCommon(context.release(), |
| 47 size, | 48 size, |
| 49 disallowed, |
| 48 allowed_extensions, | 50 allowed_extensions, |
| 49 attribs, | 51 attribs, |
| 50 parent_decoder, | 52 parent_decoder, |
| 51 parent_texture_id); | 53 parent_texture_id); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void GPUProcessor::Destroy() { | 56 void GPUProcessor::Destroy() { |
| 55 DestroyCommon(); | 57 DestroyCommon(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void GPUProcessor::WillSwapBuffers() { | 60 void GPUProcessor::WillSwapBuffers() { |
| 59 if (wrapped_swap_buffers_callback_.get()) { | 61 if (wrapped_swap_buffers_callback_.get()) { |
| 60 wrapped_swap_buffers_callback_->Run(); | 62 wrapped_swap_buffers_callback_->Run(); |
| 61 } | 63 } |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace gpu | 66 } // namespace gpu |
| OLD | NEW |