| 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(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 if (parent) { | 22 if (parent) { |
| 22 parent_decoder = parent->decoder_.get(); | 23 parent_decoder = parent->decoder_.get(); |
| 23 DCHECK(parent_decoder); | 24 DCHECK(parent_decoder); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 if (!surface_->Initialize(context.get(), false)) { | 47 if (!surface_->Initialize(context.get(), false)) { |
| 47 LOG(ERROR) << "GPUProcessor::Initialize failed to " | 48 LOG(ERROR) << "GPUProcessor::Initialize failed to " |
| 48 << "initialize AcceleratedSurface."; | 49 << "initialize AcceleratedSurface."; |
| 49 Destroy(); | 50 Destroy(); |
| 50 return false; | 51 return false; |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 return InitializeCommon(context.release(), | 55 return InitializeCommon(context.release(), |
| 55 size, | 56 size, |
| 57 disallowed |
| 56 allowed_extensions, | 58 allowed_extensions, |
| 57 attribs, | 59 attribs, |
| 58 parent_decoder, | 60 parent_decoder, |
| 59 parent_texture_id); | 61 parent_texture_id); |
| 60 } | 62 } |
| 61 | 63 |
| 62 void GPUProcessor::Destroy() { | 64 void GPUProcessor::Destroy() { |
| 63 if (surface_.get()) { | 65 if (surface_.get()) { |
| 64 surface_->Destroy(); | 66 surface_->Destroy(); |
| 65 surface_.reset(); | 67 surface_.reset(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (surface_.get()) { | 132 if (surface_.get()) { |
| 131 surface_->SwapBuffers(); | 133 surface_->SwapBuffers(); |
| 132 } | 134 } |
| 133 | 135 |
| 134 if (wrapped_swap_buffers_callback_.get()) { | 136 if (wrapped_swap_buffers_callback_.get()) { |
| 135 wrapped_swap_buffers_callback_->Run(); | 137 wrapped_swap_buffers_callback_->Run(); |
| 136 } | 138 } |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace gpu | 141 } // namespace gpu |
| OLD | NEW |