| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "base/thread_local.h" | 9 #include "base/thread_local.h" |
| 10 #include "chrome/renderer/command_buffer_proxy.h" | 10 #include "chrome/renderer/command_buffer_proxy.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DCHECK(size.width() >= 0 && size.height() >= 0); | 113 DCHECK(size.width() >= 0 && size.height() >= 0); |
| 114 | 114 |
| 115 if (!channel_->ready()) | 115 if (!channel_->ready()) |
| 116 return false; | 116 return false; |
| 117 | 117 |
| 118 // Ensure the gles2 library is initialized first in a thread safe way. | 118 // Ensure the gles2 library is initialized first in a thread safe way. |
| 119 Singleton<GLES2Initializer>::get(); | 119 Singleton<GLES2Initializer>::get(); |
| 120 | 120 |
| 121 // Allocate a frame buffer ID with respect to the parent. | 121 // Allocate a frame buffer ID with respect to the parent. |
| 122 if (parent_) { | 122 if (parent_) { |
| 123 parent_->gles2_implementation_->MakeIds(1, &parent_texture_id_); | 123 parent_texture_id_ = parent_->gles2_implementation_->MakeTextureId(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Create a proxy to a command buffer in the GPU process. | 126 // Create a proxy to a command buffer in the GPU process. |
| 127 if (view) { | 127 if (view) { |
| 128 command_buffer_ = channel_->CreateViewCommandBuffer(view); | 128 command_buffer_ = channel_->CreateViewCommandBuffer(view); |
| 129 } else { | 129 } else { |
| 130 CommandBufferProxy* parent_command_buffer = | 130 CommandBufferProxy* parent_command_buffer = |
| 131 parent_ ? parent_->command_buffer_ : NULL; | 131 parent_ ? parent_->command_buffer_ : NULL; |
| 132 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 132 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
| 133 parent_command_buffer, | 133 parent_command_buffer, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return true; | 179 return true; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void Context::ResizeOffscreen(const gfx::Size& size) { | 182 void Context::ResizeOffscreen(const gfx::Size& size) { |
| 183 DCHECK(size.width() > 0 && size.height() > 0); | 183 DCHECK(size.width() > 0 && size.height() > 0); |
| 184 command_buffer_->ResizeOffscreenFrameBuffer(size); | 184 command_buffer_->ResizeOffscreenFrameBuffer(size); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void Context::Destroy() { | 187 void Context::Destroy() { |
| 188 if (parent_ && parent_texture_id_ != 0) | 188 if (parent_ && parent_texture_id_ != 0) |
| 189 parent_->gles2_implementation_->FreeIds(1, &parent_texture_id_); | 189 parent_->gles2_implementation_->FreeTextureId(parent_texture_id_); |
| 190 | 190 |
| 191 delete gles2_implementation_; | 191 delete gles2_implementation_; |
| 192 gles2_implementation_ = NULL; | 192 gles2_implementation_ = NULL; |
| 193 | 193 |
| 194 if (command_buffer_ && transfer_buffer_id_ != 0) { | 194 if (command_buffer_ && transfer_buffer_id_ != 0) { |
| 195 command_buffer_->DestroyTransferBuffer(transfer_buffer_id_); | 195 command_buffer_->DestroyTransferBuffer(transfer_buffer_id_); |
| 196 transfer_buffer_id_ = 0; | 196 transfer_buffer_id_ = 0; |
| 197 } | 197 } |
| 198 | 198 |
| 199 delete gles2_helper_; | 199 delete gles2_helper_; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 if (!context) | 338 if (!context) |
| 339 return BAD_CONTEXT; | 339 return BAD_CONTEXT; |
| 340 | 340 |
| 341 return context->GetError(); | 341 return context->GetError(); |
| 342 #else | 342 #else |
| 343 return NOT_INITIALIZED; | 343 return NOT_INITIALIZED; |
| 344 #endif | 344 #endif |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace ggl | 347 } // namespace ggl |
| OLD | NEW |