OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_platform_context_3d_impl.h" | 5 #include "content/renderer/pepper_platform_context_3d_impl.h" |
6 | 6 |
7 #include "content/renderer/render_thread.h" | 7 #include "content/renderer/render_thread.h" |
8 #include "content/renderer/gpu/renderer_gl_context.h" | 8 #include "content/renderer/gpu/renderer_gl_context.h" |
9 #include "content/renderer/gpu/gpu_channel_host.h" | 9 #include "content/renderer/gpu/gpu_channel_host.h" |
10 #include "content/renderer/gpu/command_buffer_proxy.h" | 10 #include "content/renderer/gpu/command_buffer_proxy.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) | 105 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) |
106 return false; | 106 return false; |
107 | 107 |
108 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( | 108 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( |
109 &PlatformContext3DImpl::OnContextLost)); | 109 &PlatformContext3DImpl::OnContextLost)); |
110 | 110 |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | |
115 DCHECK(command_buffer_); | |
116 command_buffer_->SetSwapBuffersCallback(callback); | |
117 } | |
118 | |
119 unsigned PlatformContext3DImpl::GetBackingTextureId() { | 114 unsigned PlatformContext3DImpl::GetBackingTextureId() { |
120 DCHECK(command_buffer_); | 115 DCHECK(command_buffer_); |
121 return parent_texture_id_; | 116 return parent_texture_id_; |
122 } | 117 } |
123 | 118 |
124 gpu::CommandBuffer* PlatformContext3DImpl::GetCommandBuffer() { | 119 gpu::CommandBuffer* PlatformContext3DImpl::GetCommandBuffer() { |
125 return command_buffer_; | 120 return command_buffer_; |
126 } | 121 } |
127 | 122 |
128 int PlatformContext3DImpl::GetCommandBufferRouteId() { | 123 int PlatformContext3DImpl::GetCommandBufferRouteId() { |
129 DCHECK(command_buffer_); | 124 DCHECK(command_buffer_); |
130 return command_buffer_->route_id(); | 125 return command_buffer_->route_id(); |
131 } | 126 } |
132 | 127 |
133 void PlatformContext3DImpl::SetContextLostCallback(Callback0::Type* callback) { | 128 void PlatformContext3DImpl::SetContextLostCallback(Callback0::Type* callback) { |
134 context_lost_callback_.reset(callback); | 129 context_lost_callback_.reset(callback); |
135 } | 130 } |
136 | 131 |
| 132 bool PlatformContext3DImpl::Echo(Task* task) { |
| 133 return command_buffer_->Echo(task); |
| 134 } |
| 135 |
137 void PlatformContext3DImpl::OnContextLost() { | 136 void PlatformContext3DImpl::OnContextLost() { |
138 DCHECK(command_buffer_); | 137 DCHECK(command_buffer_); |
139 | 138 |
140 if (context_lost_callback_.get()) | 139 if (context_lost_callback_.get()) |
141 context_lost_callback_->Run(); | 140 context_lost_callback_->Run(); |
142 } | 141 } |
143 | 142 |
144 #endif // ENABLE_GPU | 143 #endif // ENABLE_GPU |
OLD | NEW |