| 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 "chrome/renderer/pepper_platform_context_3d_impl.h" | 5 #include "chrome/renderer/pepper_platform_context_3d_impl.h" |
| 6 | 6 |
| 7 #include "chrome/renderer/command_buffer_proxy.h" | 7 #include "chrome/renderer/command_buffer_proxy.h" |
| 8 #include "chrome/renderer/ggl/ggl.h" | 8 #include "chrome/renderer/ggl/ggl.h" |
| 9 #include "chrome/renderer/gpu_channel_host.h" | 9 #include "chrome/renderer/gpu_channel_host.h" |
| 10 #include "chrome/renderer/render_thread.h" | 10 #include "chrome/renderer/render_thread.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }; | 66 }; |
| 67 std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); | 67 std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); |
| 68 CommandBufferProxy* parent_command_buffer = | 68 CommandBufferProxy* parent_command_buffer = |
| 69 ggl::GetCommandBufferProxy(parent_context_); | 69 ggl::GetCommandBufferProxy(parent_context_); |
| 70 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 70 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
| 71 parent_command_buffer, | 71 parent_command_buffer, |
| 72 gfx::Size(1, 1), | 72 gfx::Size(1, 1), |
| 73 "*", | 73 "*", |
| 74 attribs, | 74 attribs, |
| 75 parent_texture_id_); | 75 parent_texture_id_); |
| 76 if (!command_buffer_) |
| 77 return false; |
| 76 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( | 78 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( |
| 77 &PlatformContext3DImpl::OnContextLost)); | 79 &PlatformContext3DImpl::OnContextLost)); |
| 78 | 80 |
| 79 if (!command_buffer_) | |
| 80 return false; | |
| 81 | |
| 82 return true; | 81 return true; |
| 83 } | 82 } |
| 84 | 83 |
| 85 void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | 84 void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) { |
| 86 DCHECK(command_buffer_); | 85 DCHECK(command_buffer_); |
| 87 command_buffer_->SetSwapBuffersCallback(callback); | 86 command_buffer_->SetSwapBuffersCallback(callback); |
| 88 } | 87 } |
| 89 | 88 |
| 90 unsigned PlatformContext3DImpl::GetBackingTextureId() { | 89 unsigned PlatformContext3DImpl::GetBackingTextureId() { |
| 91 DCHECK(command_buffer_); | 90 DCHECK(command_buffer_); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 105 | 104 |
| 106 // We will lose the parent context soon (it will be reallocated by the main | 105 // We will lose the parent context soon (it will be reallocated by the main |
| 107 // page). | 106 // page). |
| 108 parent_context_ = NULL; | 107 parent_context_ = NULL; |
| 109 parent_texture_id_ = 0; | 108 parent_texture_id_ = 0; |
| 110 if (context_lost_callback_.get()) | 109 if (context_lost_callback_.get()) |
| 111 context_lost_callback_->Run(); | 110 context_lost_callback_->Run(); |
| 112 } | 111 } |
| 113 | 112 |
| 114 #endif // ENABLE_GPU | 113 #endif // ENABLE_GPU |
| 115 | |
| OLD | NEW |