Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_platform_context_3d_impl.h" | 5 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/common/gpu/client/context_provider_command_buffer.h" | 8 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
| 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 return SetParentAndCreateBackingTextureIfNeeded(); | 119 return SetParentAndCreateBackingTextureIfNeeded(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool PlatformContext3DImpl::SetParentAndCreateBackingTextureIfNeeded() { | 122 bool PlatformContext3DImpl::SetParentAndCreateBackingTextureIfNeeded() { |
| 123 if (parent_context_provider_ && | 123 if (parent_context_provider_ && |
| 124 !parent_context_provider_->DestroyedOnMainThread() && | 124 !parent_context_provider_->DestroyedOnMainThread() && |
| 125 parent_texture_id_) | 125 parent_texture_id_) |
| 126 return true; | 126 return true; |
| 127 | 127 |
| 128 parent_context_provider_ = | 128 parent_context_provider_ = static_cast<ContextProviderCommandBuffer*>( |
|
joth
2013/06/02 19:08:55
could we change parent_context_provider_ to be a
boliu
2013/06/03 18:51:24
ContextProvider api is the almost same, just the C
| |
| 129 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 129 RenderThreadImpl::current()->OffscreenContextProviderForMainThread() |
| 130 .get()); | |
| 130 parent_texture_id_ = 0; | 131 parent_texture_id_ = 0; |
| 131 if (!parent_context_provider_) | 132 if (!parent_context_provider_) |
| 132 return false; | 133 return false; |
| 133 | 134 |
| 134 // Flush any remaining commands in the parent context to make sure the | 135 // Flush any remaining commands in the parent context to make sure the |
| 135 // texture id accounting stays consistent. | 136 // texture id accounting stays consistent. |
| 136 gpu::gles2::GLES2Implementation* parent_gles2 = | 137 gpu::gles2::GLES2Implementation* parent_gles2 = |
| 137 parent_context_provider_->Context3d()->GetImplementation(); | 138 parent_context_provider_->Context3d()->GetImplementation(); |
| 138 parent_gles2->helper()->CommandBufferHelper::Finish(); | 139 parent_gles2->helper()->CommandBufferHelper::Finish(); |
| 139 parent_texture_id_ = parent_gles2->MakeTextureId(); | 140 parent_texture_id_ = parent_gles2->MakeTextureId(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { | 212 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { |
| 212 DCHECK(command_buffer_); | 213 DCHECK(command_buffer_); |
| 213 | 214 |
| 214 if (!console_message_callback_.is_null()) | 215 if (!console_message_callback_.is_null()) |
| 215 console_message_callback_.Run(msg, id); | 216 console_message_callback_.Run(msg, id); |
| 216 } | 217 } |
| 217 | 218 |
| 218 } // namespace content | 219 } // namespace content |
| 219 | 220 |
| 220 #endif // ENABLE_GPU | 221 #endif // ENABLE_GPU |
| OLD | NEW |